Specifically, the Army (I believe), and I'm sure other branches of the armed forces, have training manuals on how to interact with people in ways to keep both parties (the would-be combatants/rioters AND other military personnel) from boiling over. This is the sort of this that is incredibly useful, a necessity even, when you're in an active war zone. There's a direct translation over to civilian life, though. At the end of the day, you're trying to keep the peace.
Does it always work? I don't know: I'm not military personnel, nor a LEO, and I haven't looked at all of the available data. As a person who isn't comfortable with the amount of force that local law enforcement in America shows to all people, innocent or guilty, I can tell you 100% that I would personally feel better if I never saw officers show up in armored vehicles.. ever. They're not trained for it, they shouldn't have it.
If you dress for going to war, a war you should find.
I already pay taxes, do I have to give the government solutions to all problems in society in a silver platter too? Why don't they use some of that money to research an answer to that very question? Because guns.
I mean, there could be a foam that slows people down when sprayed. Or a net that makes it confusing to walk. Who knows. So many possibilities. But guns!
In your ideal world, when exactly should the police gear up to disperse a crowd? While it's actively rioting?