If women and men differ in some respects, on average, and those differences result in population-level differences in job interests,  one would expect gender differences in the proportion of men and women who pursue certain occupations.

Women and men do differ in job interests. For example:

Men and women also differ, on average, in how long they stay in certain career fields. Men, for instance, are more likely to persist in engineering careers than women (Mau 2003; Singh and Fouad, 2011). Partly this may be a matter of unsupportive and hostile environment created by male teachers, co-workers, and supervisors. But then you have to ask why women are doing so much better in other traditionally male-dominated fields. For example, consider law and medicine, in which women's entrance rates are at near-parity with those of men:

Women also tend to be more satisfied with their jobs in non-engineering professions, even when controlling for pay, family commitments, and gender of co-workers (Glass et al, 2013). Their job retention in other professions is much higher as well:

Source: Glass et al (2013) What’s So Special about STEM? A Comparison of Women’s Retention in STEM and Professional Occupations

Source: Glass et al (2013) What’s So Special about STEM? A Comparison of Women’s Retention in STEM and Professional Occupations

Are male engineers simply more sexist and less welcoming of female students and coworkers than other male professionals?  If we were only talking about the perniciousness of men, we would expect similar gender patterns in a broad range of traditionally male-dominated occupations. But we don't. There's something special about engineering.

I think the gender differences we see in engineering are the effect of an interaction between a difficult work environment and enthusiasm for the field. If men and women differ, on average, in their attraction to an occupation, there are likely to be gender differences in responses to job-related challenges as well. For instance, ambivalence towards an occupation may lower one's job/career stress tolerance threshold.  If the work is merely okay, you put up with less. If you're really into what you do, you put up with more.

Of course,  that doesn’t excuse on-the-job bullshit directed at female employees. Employers must work hard to minimize the pain and maximize the payoff to help all workers thrive on the job, including those workers -  could be men, could be women - who aren't 100% into what they're doing. Even if influenced by biological factors, enthusiasm to perform certain kinds of tasks or solve certain kinds of problems isn't a fixed quantity but grows or shrinks in response to what the world offers. 

Next: People and things

References:

Glass, J. L., Sassler, S., Levitte, Y., & Michelmore, K. M. (2013). What’s So Special about STEM? A Comparison of Women’s Retention in STEM and Professional Occupations. Social Forces; a Scientific Medium of Social Study and Interpretation, 92(2), 723–756. http://doi.org/10.1093/sf/sot092

Mau, W.-C. (2003), Factors That Influence Persistence in Science and Engineering Career Aspirations. The Career Development Quarterly, 51: 234–243. doi:10.1002/j.2161-0045.2003.tb00604.x

Singh and Fouad Understanding Women’s Persistence in Engineering Careers 2011 WEPAN National Conference Presentation