People being regular-shitty, combined with context, like making comments about the appearance and intelligence of the only other woman in the office, can create an inhospitable environment that forces women out. Companies that wish to hire and retain women should proactively create a hospitable environment or situations like above will occur.
The bigger thing is that it seems like you don't see return on investment into creating these better environments. Do you feel that diversity initiatives are wholly unnecessary or just poorly designed/targeted?
Regardless, my original stance was more aimed at the societal push of "get x demographic into tech". I'm not going to retype my thoughts on that - go read the other comments of mine in this comments section to get a clearer picture.