In the field of law (which is my original background) you can pretty much walk into any sizeable firm, look around for the female partners and know you have identified the family law or employment law team.
Is this because all women who become lawyers have a burning desire to handle divorces or employment tribunals?
Perhaps?
Or perhaps was it the case that historically law firms (then run exclusively by men) were most willing to admit females into the partnership in areas deemed "feminine" before they did likewise for macho stuff like construction or commercial litigation. Thereafter, a meaningful % of female trainees looked around on their first day and figured out where their most likely root to a partnership lay. And so the cycle perpetuated.
That this cycle is increasingly being broken in the legal sector is, I'd argue, as much because of the sheer weight of numbers (more than 50% of law grads are women), as it is down to a more enlightened approach by male partners.
In the abstract, I'd argue that it is not sexism that puts people off choosing a career path, but rather it is a combination of not wanting to fight against the current (not everyone fancies being a trailblazer) as well as the innate human desire to belong to a tribe that physically resembles themselves.
Or to put it another way, I greatly enjoy the company of women, but if I had walked into a lecture theatre and been the only guy present, I'd have felt very much that I was in the wrong room no matter how much I loved the subject (or the attention!)
(Edit: Despite what I wrote in the last paragraph, I must acknowledge that currently I am working in a 4 person startup, three of whom are female including the technical lead.)