Can confirm this anecdotally.
I'm from a developing country. I was always creative and way better at arts than science. Had zero opportunities in arts. Now I have a PhD in a STEM field from the US and I fantasize everyday of just waking out of this sexist cesspool and going back to arts.
If I had grown up in the US there's very little chance I'd have chosen the sciences.
What I've read is that STEM men tend to be good at math/science and not social stuff, but STEM women tend to be good at both. I saw this in high school where gifted boys were not as good in English as gifted girls were, even though we all did equally well in math/science.
So as fields have opened up, more women have gone into medicine and law and fewer into engineering. Sexism in engineering (and computer science) has also been an issue but I think a lot of women just found socially-oriented fields to be more satisfying.