This is not as stupid as it sounds.
STEM programs often use “weed-out” classes, where it’s very difficult to get a decent grade. Students who are mediocre, but committed as hell to succeeding in STEM will take the C-, or maybe even repeat the class several times to pass. Students who feel less like they belong, on the other hand, will drop the class if they fear the B will mess up their GPA. And women are much more likely to fall in that second category.
If the women STEM students don't want it as badly as the men and so drop out anyway...that's on them.