That said, I don't think this is something that can be entirely addressed by government action. Government can take action against overt harassment, but you can't pass a law against your grandma thinking your job means you're gay (true story, in the case of a friend of mine).
People will always have various pressures and cultural biases that inform what occupations are picked. Humans are not the same, not every difference of opinion needs to be stamped out however misguided you believe them to be.
I remember reading a story about such a case some years ago. The male teacher in it had eventually proven his innocence and that the child was a malicious liar, but the process had wrecked his family and made him unemployed. He wasn't going back into teaching and stated to the press, very clearly, that no man should ever work with children because the female-dominated profession would always find a man guilty until proven innocent, regardless of the merits of any case. I remember it clearly because his view was so stark, so bleak and yet so well articulated and justified. I decided right there and then that I'd take his advice and stay well away from teaching.
Not that things change much as adults, of course. Every time there's a run of men proving their innocence in false rape cases (in the UK), feminists go nuts and insist the law is changed to prevent men using that tactic to prove their innocence in future. The "females must always win" mentality is pervasive and makes working in female dominated professions risky.
This is where you go off the rails. I know two women that are journeyman electricians. The amount of bullshit they have to continuously turn the other cheek on is incredible. They're put in a lose lose situation where sticking up for themselves will backfire, but not being confrontational means they continue to get thrown all sorts of harassment, abuse, and a lot of nonsense about who works what task on big jobs.
When we see disparities this huge, in jobs that are definitely desirable, it's smoke. Then you actually go talk to women in these industries, and they will indeed confirm that there's a huge fire.
This is not some great philosophical question about equality of outcomes and the sad unknowable complexity of how it relates to equality of opportunity. That's just an excuse to tell people trying to put out an obvious fire that they should just stop.
In particular I'd suggest you read the history of what happened to women that learned industrial fabrication skills during WW2 and wanted to keep working with them.