While there was a decline during the initial decades of computing, that trend reversed. The fraction of women in computing peaked in the early 80s just before the PC era took off. This is fairly well known stuff you can google for sources on easily (example: https://www.computerscience.org/resources/women-in-computer-...).
There's no simple single factor explanation of this, but it is very clear something changed significantly during the PC era. The socialization of boys and girls surrounding home computers does appear to be one of the big factors, and it likely echoed forward by creating hostile educational environments as this cohort aged. This isn't enough to explain the current situation completely however.
You write a wall of text and someone complains that you missed their favorite detail.
You make it concise and someone complains that there's not enough detail.
You use strong words and someone complains that you're virtue signaling.
You take a mild tone and someone complains that you're being dismissive.
This is a slow moving 40yr transition that is intertwined with every sector of the economy at the macro and micro level. If your goal is to find a way that my few sentence comment is not perfectly accurate in describing it I'm sure you can accomplish that.
Think about what generations would be in the workforce in 1980.
Prior to the advent of readily available digital electronics to do the job arithmetic and number crunching was considered secretarial work and the field was dominated by women. This was the talent pool from which many early computer programmers were hired since they already knew the math and the business logic. They learned programming and worked in punch-cards instead of spreadsheets
As computer programming transitioned into a more engineering type profession it drew on more engineering type talent pools and hiring pipelines which were (and still are) more male.
So the question should really be why did computing become more of an engineering type profession.