I don't think that logic applies, or results in too shallow an observation. If you reverse it, say for men and the profession of dental hygienists, could you say the field has fewer men because of discrimination?
There are likely many reasons as to why there are fewer women in STEM fields than men. Culture and socio-economics are two very big factors being completely dismissed here.
Chalking everything up to discrimination is intellectually lazy (unless there's good data presented and indicating that to be fact), and does nothing to help the situation. If you don't fully understand the root cause, how can you resolve the problem?
There are plenty of alternative hypotheses. For example lack of role models encouraging advancement, gender stereotypes reducing intake, and brain differences that make the subject a better fit for men.
We should, of course, attempt to address and improve on all of the possible explanations except the last. If it isn't the last and we make the mistake of assuming that one, then there is harm in that assumption. If the last does contribute, then there is little harm finding that out after making an honest attempt to improve things. Because there are bound to be multiple contributing causes, and you'll at least make the situation better.