Glad to know that this helped clear things up.

>in general men are much more capable then women in STEM and I asked for a theory supporting that claim in my original comment

Short, inexact, unnuanced version: The same thing that causes a 4M:1F ratio in autism diagnosis causes the similar gender skew in CS/Engineering.

First, I am going to narrow STEM to CS/Engineering which has a worse gender skew than the other parts of STEM. To massively over simplify assume we can plot all possible jobs/careers on two axis of ideas vs people. This is how much you get to work with ideas and how much you get to work with people. You could have low ideas high people (kindergarten teacher), low ideas low people (watching for forest fires), high ideas high people (college professor), high ideas low people (engineering). All the different jobs are spread around this plot. Lets simplify and assume a Person picks the job that best matches there Preference.ideas and Preference.people. Once they pick a job they get Income based on their Ability.

We now have a loose correlation in the population where Person.Preference affects count(XJob()) and Person.Ability affects avg(Job().Income) (and simplifications/assumptions abound).

Now, assuming 1) CS/Engineering is a job that requires high (90%) Person.Preference.ideas and a low (20%) Person.Preference.people. Also, lets assume that 2) std(randM().Preference.ideas) > std(randF().Preference.ideas) and std(randM().Preference.people) < std(randF().Preference.people) (std == standard deviation). These two things in combination could cause us to see more Males than Females in CS/Engineering because standard deviation has large effects at the tails of the population.

Now, is there an basis for assumptions 1 and 2? I am going to say that you agree with 1 as how CS/Engineering currently is. The 2nd is a little bit hard to prove, in fact I don't have hard proof. I have evidence that makes me think it is the case. If you request, I can try and find sources for my claims.

1) Baby boys like to play with trucks/balls, baby girls like to play with dolls.
Objection: That is cultural conditioning and not sexually determined.
Response: Baby monkeys have shown the same gendered preferences.

2) When looking at college application, males apply for CS/Engineering at rates much higher than females.
Objection: Culture preprograms this into people.
Response: If this was only cultural preprogramming, it should have went away as it when away in Law, Medicine, and Finance.

3) Autism affects males over females 4:1. One explanation of this is the Extreme Male Brain theory of autism [0]. From that portion of wiki "Baron-Cohen's research on relatives of people with Asperger syndrome and autism found that their fathers and grandfathers are twice as likely to be engineers as the general population." Also, "Another similar finding by Baron-Cohen in California has been referred to as the Silicon Valley phenomenon, where a large portion of the population works in technical fields, and he says autism prevalence rates are ten times higher than the average of the US population. These data suggest that genetics and the environment play a role in autism prevalence, and children with technically minded parents are therefore more likely to be diagnosed with autism."

My laymen's take on the above, the same thing that makes males more likely to have autism make them more likely to be engineers.
Objection: Haven't heard yet.

So in summary, since CS/Engineering is an outlier on the ideas/people axis and males are more likely to match that outlier we see more males in CS/Engineering.

[0] https://en.wikipedia.org/wiki/Empathizing%E2%80%93systemizin...