Computer programming once had much better gender balance than it does today. What went wrong?

Specific rates of % female in STEM majors below. There is little difference in % female between engineering (22%) and CS (19%). Physics (21%) is also similar to engineering and CS. The larger difference more relates to biological (61%) and pre-med type majors, which have much higher % female than both CS and engineering. Women are over-represented in biology. Women are also well represented among med school applicants. 50% of med school applicants and 52% of matriculants were women in 2018-19.

2017 Bachelor Degrees Conferred: Total
CS – 19% women
Physics – 21% Women
Engineering – 22% Women
Earth Sciences – 39% Women
Math and Stats – 41% women
Chemistry – 49% Women
Biology – 61% women

It’s not simply a matter of more quantitative vs less quantitative, as women also have decent representation in mathematics (41%), nor is a matter of women avoiding applied STEM, as women have a higher representation in applied math than theoretical. I also don’t think it’s simply a matter of stiffer competition and selection, as med school admission is probably more competitive and selective than both CS and engineering. Instead I expect that there is not a simple answer and are a variety of contributing factors, which have been well discussed in this thread.