The point isn't to find an explanation for it. This sort of behavior drives people out of technology (or pick your industry). I wouldn't dream of going up to someone, with or without cause, insulting them and questioning their capabilities based on some irrelevant detail -- in my case, gender. Let's communicate that this sort of behavior is unacceptable, and let's do it by calling it out. People won't learn unless we tell them.
The insidious aspect of this idiocy is that any attempt to educate by myself and my colleague is undermined by the individual's bias, so no matter what we say, it won't be taken seriously or given any weight. This is why good allies are invaluable.
Also, I take issue with the idea that hitting on someone is the primary reason to "[talk] to females." Hey, I'm a person with interests and expertise. How about talking to me about that?