It's like boiling a frog. Dude starts with fairly innocent flirty stuff. Woman doesn't object, or not much anyway, because it's not that bad and easily laughed off or ignored. Dude figures he is getting away with it, so pushes a little harder, and woman has already assented once, and she really wants the job so she figures she can just put up with it. That's how it starts, and that's how it gets worse.
I've worked with and been friends with quite a few talented women, and many have related some variation of this story to me. It's easier than it used to be to call men on this behavior now, and men seen generally more aware of the risks of this kind of behavior now, so it seems like it's not happening quite as much. But there are a lot of guys, either clueless about women in general or just comfortable being shitty to get what they want, and women put up with it because it's just easier -- until it isn't, and they're stuck.