I believe your comment was out of ignorance and meant honestly, but it comes off as a bit flippant. "Because it's not seen as cool" is certainly not the main reason -- it's a symptom of the systemic marginalization and mistreatment women have and still face in so many fields, STEM especially.
All places I have worked women have been held in hands, I have not seen any of this systemic marginalization and mistreatment. I think this old trope is long past its due date and should be relegated to a past which is no longer here. Just repeating it only leads to the dismissal of past claims of such because people will start to equate the current situation - where women are treated preferentially to men - with a past and wonder whether those claims of past abuse were just as shallow as the current.
So, stop it already and also recognise the fact that, for whatever reason, the average academically inclined woman is less interested in these fields than the average academically inclined man. My two daughters have no such interest whatsoever, nor do my brothers' two daughters. In my oldest daughter's class there are exactly zero girls who have chosen a STEM-related path.
This is in Sweden, the best country for women [1] where the doors are wide open to them. They just don't think a future diddling with things and numbers is as interesting as one dealing with people or animals - viz. my wife who is a horse veterinarian working in a clinic run by a woman with only female vets and nurses. There are some men who work there on contract, they are farriers. There is a male visiting surgeon who does arthroscopy, he comes by every now and then. My wife's old professor from Liverpool also comes by every once in a while for difficult operations so that makes two men against ~30 women. The veterinary college now has ~95% female students, i.e. this field is more heavily skewed towards females than STEM is towards males. For some reason this is not seen as a problem in need of solving, why is that?
[1] just search for "sweden best country for women" in your favourite search thing