For us, it was because her field (immunology) was simply less lucrative than mine (computer science). Given the differences in gender distributions between both fields, and the pay gap between fields, I think simplifying this as STEM collectively isn't sufficiently granular. I wonder what the rates are for "left CS after child" vs "left biology after child", and how they compare.
With that being said, it's likely that there are also systemic/structural differences as well; research (and academia in particular) is notorious for poor work-life balance (prior to tenure). Social undercurrents of expectation towards primary caregivers would certainly have some influence as well.
I know it shifts the narrative slightly, but I would also be interested to see the effects of PhDs on birthrates, broken down by field, gender, and country of birth. It seems to me that it would be negatively correlated, but I don't have the data to back up that observation.