#1. Most of us are fairly bright enough to know where such mobs are likely. (Not to mention the places where self defense is "illegal.")
#2. Most of us are, therefore, smart enough to know it's not likely a good place to go and will stay away.
#3. If, for some unavoidable reason, one were to find themselves confronted with a dangerous situation like this, I'd think situational awareness would allow us to notice problems from the very start and make tracks to leave or find cover.
#4. If one could not leave, and a potentially lethal attack began (remember, you don't have any obligation to read their minds), one would have to take whatever steps were necessary to stop as many of the attackers as possible. Unless there were hundreds of them, whipped to an insane rage, sight of the first few to fall would probably end the encounter.
Ultimately, there are no guarantees. We just do the best we can with what we have to work with.
The best gunfight is the one that never happened... so just don't go there. Anyway, that's my plan.