It could very well be that women have had the potential to outperform men in academic tasks since Socrates, but never had the chance until widespread and egalitarian schooling.
The issue is that a lot of people don't really define stem as stem, they define it as RCE-research, computers, and engineering.
Linking the pew article for more detail: https://www.pewsocialtrends.org/2018/01/09/diversity-in-the-...
Besides the point. Have you ever had a favorite teacher who told you that you were destined for failure? Probably not, that teacher is never gonna be your favorite -- and spending a semester, or even years, with that teacher might well sour you on the subject even if it was your favorite.
I'm optimistic that we will eventually reach a fully egalitarian future, but pessimistic at how much work is left to do.