This is a non-PC opinion to match yours (which I largely agree with), but I think the desire to learn how to program is highly related to the desire to tinker and build, something which my life experience has shown to be much more prevalent in males than females (wood working, model building, car tinkering, etc. being largely male hobbies)
In addition to that, until recently, programming was a pretty high risk career choice. I think most people would not have predicted the sheer quantity of upper middle class careers that now exist in technology. I know when I was in college the received wisdom was that you became a doctor or a lawyer if you wanted a low-risk path to an upper middle class lifestyle. And I think those two professions are much more evenly balanced between males and females as a result.
I buy the risk argument in theory; anecdotally, friends who are women in tech seem to worry a bit more than friends who are men in tech about long-term career stability. But tech has been low-risk for the last few decades. Even when I was very young I remember being aware that Bill Gates was the richest man in the world, and he did programming, and programming was a thing I could learn. And the number of women in tech has been dropping since approximately the time Bill Gates became the richest man in the world.
I think the risk argument could apply well to high-risk tech career decisions, though, of which there are still quite a few like founding startups. But becoming a rank-and-file software engineer at a big corporation has been a low-risk high-reward career choice for a good while.
See, for instance, this graph of the proportion of CS graduates by gender (from ComputerWorld):
http://core0.staticworld.net/images/idge/imported/article/ct...
We only know that because we have the benefit of hindsight. But for somebody growing up in the 80s, 90s, and 00s outside of Silicon Valley, I don't think that it would have been seen as low risk when they were deciding what career to pursue.
Think about it. The reason software engineering has been a great profession for the last 3 decades is because an unprecedented number of software engineering jobs have been created in that time span. But most of those jobs didn't exist 3 decades ago (or even just one decade ago).
Somebody who can hack it as a software engineer can probably also hack it as a doctor or a lawyer. Choosing software engineering over law or medicine was definitely taking a risk. You probably had to relocate for a job, whereas jobs in law and medicine exist in most of the country. People were making good money as software engineers, but you couldn't be sure that would continue (I mean, there was the crash in 2000).
Again, not in hindsight. In hindsight, it was a reasonable choice, especially since you avoid huge additional schooling costs. But if you were making that decision 10 or 20 years ago, it was definitely taking a risk vs. the established career paths that law or medicine offer.
Yes, my wife sews and knits. Hence my position that it's not really about raw ability.
I think the entry route to programming has historically had a lot in common with how somebody starts tinkering with machines (cars, appliances, farm equipment, timepieces, etc), despite the fact that programming is about manipulating abstract concepts and tinkering is about manipulating physical machines.
When telling their origin stories, many programmers will start by recounting the first physical computer they owned and how programming was a result of learning how to manipulate that machine. To me, it sounds an awful lot like how car guys talk about their first cars.
Anyway, just a hunch.
Once you have that, what's the argument that male brains are better at that particular type of thinking? The fact that more men happen to be employed to do this thinking isn't an argument; at best it's initial evidence that would inspire you to create a hypothesis, but it's not the end of the study by any means.
The interpretation that seems most likely to me, but which is unfortunately horribly politically incorrect, is that men are more likely to be territorial assholes about high-status positions in society, and we'll preserve our exclusivity when we have it. This manifests as us being better at $field for any $field because we don't allow women to have a chance to succeed. (We might allow enough of a chance to succeed so we can avoid accusations of sexism, which would risk our exclusivity, but we don't want to go so far that we concede the exclusivity on our own.) At least this hypothesis has the advantage of the known fact that having an aggressive personality is correlated with gender.