Well, it's maybe not so much blaming the victim as almost a superstitious chant against getting raped. I worked as a rape crisis counselor when I was young (too young, really shouldn't have done it, got a bit PTSD-ish from all those bloody/smelly ER scenes). But anyway, I started doing this thing that most rape counselors do. A woman got raped taking her trash out at night. "I'll never take my trash out at night," I thought. A woman got raped after putting an ad in the paper to sell a car and stabbed 17 times, too. "Well, I'll always use a car dealership from now on." A woman got raped after her car broke down and she accepted a ride from a "good samaritan." I thought... well, you see how it goes. Finally, I got a victim who had been raped sleeping in her own bed at night behind locked doors and windows. Now what am I going to do to stop myself from being raped, eh? I realized all my rules were senseless, and I could take the trash out and sell my car from now on, too.
The truth is, any woman can get raped in any circumstance. Daytime? yep. By a person you know and trust? Absolutely. By a cop helping you? Surely. So I learned a lot of self-defense and five lovely ways to kill people with my bare hands, and I'd do it, no doubt of it. I'd do it and enjoy it, probably, bad me. If he has a gun, I get raped. That's the horrible reality.
So that "she should have..." talk isn't necessarily blaming the victim. It's part of that wrong-headed hope that we're too smart to be raped and if only we follow these magical laws we make up, we won't be.
The rapist being stupid--that's just criminals. Brilliant fictional felons like Hannibal Lecter are fictional. Real felons are, over 99% of the time, idiots.