I suspect that the high likelihood of encountering armed resistance would stop most of these lunatic cowards before they ever acted. Especially if they didn't know who might be armed or when. They might just go somewhere else instead, but that's another issue altogether.
I think that you're on to something, actually. From what I can recall of a number of these cases, putting up resistance tends to deter the attacker. Apparently, being shot at or confronted by an armed citizen or police officer makes these people change course:
Just a few I can think of:
1. columbine: the 2 perps were exiting (planning on escape) when they ran into some early responders; they exchanged a few shots, then retreated to the library and shot themselves.
2. Brazilian school shooting. Police said the gunmen shot himself in the head after he was confronted by officers.
3. Sandy Hook: perp shoots himself as police officers approach.
4. tacoma mall shooting in 2005. An armed citizen confronts the shooter. That doesn't end well for the citizen, but the shooter takes hostages and holes up.
I think that these types are so involved in their own little world that when reality intrudes, they really haven't taken that into account and they have a little bit of a crisis and start thinking of plan b.