This can appear to be true even if men don't, on average, change their behavior at all.
Think about it: if 10% of the people in a field are female, that means that 90% of a woman's interactions in the field are with men. If the field becomes more balanced, that will come down towards 50%.
Even if men in the field individually keep acting the same, that's almost a 50% reduction in the amount of sexism a woman will experience, because she's interacting with fewer men and more women. We tend to notice offensive things by counting them, not by figuring out expected values based on sample sizes, so things would appear to improve, even though the men will not have changed their behavior at all.
The real WTF odd fact is that as the field tips towards 50/50 women, the amount of sexism that (non-sexist) men will observe will actually go up, because a higher proportion of the interactions they observe will be male/female (whereas with a highly tilted sex ratio, they usually mainly see male/male conversations taking place).
IMO the real problem with the lopsided male/female ratio in tech is that women experience almost double the harassment they would if it was 50/50, so they think things are much worse than "average", and meanwhile men witness a much smaller amount (almost 3:1), so they think things are better.
Then both sides clash, and argue about whether there's a problem or not, relative to other industries. Based on their observations, both men an women could probably be forgiven for jumping to the conclusions that they do; unfortunately, I haven't seen any sort of actual numbers that might help pin down whether men in tech are actually worse, better, or the same as men in other fields. That women experience more harassment does not necessarily mean individual men are more likely to harass.