Edit: probably more telling is that both law and medicine are heavily involved in a sense of social responsibility, something that women are traditionally socialised for. Engineering not so much.
Software engineering doesn't have that (yet?)
All my friends, even those with a similar (or more advanced) aptitude and interest in computers, chose different paths. Chemistry. Theoretical Physics. History. Politics. Economics.
Nobody wanted to be doing computing professionally. Men were/are afforded to be outcasts or underdogs, socially; there's some romanticism to it. I'm not sure the same has applied for women, but maybe that's changing.
Sure, there are religious, geographical, and socio-economic holdouts, but I think that this is one of the three big factors.
The second is that men tend to drop out to get jobs. If you can make $150k out of school with a BS EECS, why go to law or med school? Again, using my wife and her circle of female attorneys as examples, women seem to be more interested in personal satisfaction and are willing to pay a price for it, whether it's working in a rough environment (Kabul, Kosovo, Department of Homeland Security) or postponing that satisfaction by spending more time in school.
The third is that med and law school are great careers with a lot of opportunities for women who want to have children. Sure, there's partner track that will not necessarily be an option, but again, they don't always have the same "must be alpha" drive that men do. They can take a year off, maybe start back in a step behind, maybe work part time, but know that they can do the job they like, with variety in cases, until they decide to retire.
Of course, there are a bunch of contributory factors that I didn't cover and don't know how universal they are, but on the "sexist" side, it's still more acceptable for a woman to take time off and be supported by her husband than the other way around. You have exceptions, like ESR, so I don't think it's as influential.
Finally, they still put up with a lot of sexism, but they know it's wrong and that it is not a reflection on them, but on the morons trying to put them down. Not that it doesn't hurt, but sometimes hurt is a good motivator to succeed in spite of others.
[1] For want of a better word. [2] Just as I am better at feats of strength than my wife, who works out 1-2x/daily, but she is better at doing the type of research necessary to be one of the best litigators most attorneys have seen.
And if you SE is hard try being a woman in Civil engineering - a place I worked at (an Arab Civil engineers) had to arrange a swap with an Italian Consulting engineers. All our work was in the middle east so she was unable to get the required boots on the ground experience on our projects to progress to chartered status.
But it is important to note there are plenty of industries today with high female representation, such as law and medicine, that in the recent past were bastions of male dominance. A female relative of mine went through law school in the 1950s and can tell tales of male chauvinism more extreme than you'd find anywhere today in tech or finance. But somehow, women went to law school more and more, and today represent ~50% of law classes. Something must be different about these fields, but I'm not sure what.