This is a very bad idea.
You are exactly right. Most of the replies here will get the shooter arrested and convicted no matter how unfair it seems. Most of the gun laws are very clear and specific of when you can and cannot use deadly force. I don’t agree with them but if you just start shooting at a group of people, you will probably end up in jail. Fair? No.. Reality? Yes...
In most jurisdictions being attacked by a violent mob is grounds for the use of deadly force. Do you suppose a jury would be sympathetic to the mob? Otoh, it will only take one sympathetic juror to acquit the shooter. Result: the local DA and police will lose even more respect from law-abiding citizens. Any DA with an IQ will consider this before filing against a shooter.
There needs to be a court case in which it is determined that a mob attacking an individual is deemed to be a lethal threat. Which it obviously is.