The only way to combat people with an increasingly dangerous arsenal of deadly weapons, as well as an increasing hostility for society as a whole, is a police force equipped to deal with that situation. An improperly equipped cop equals a dead cop. How many violent riots have there been based on the false implication of criminal intent by a police officer? The point of policing is to enforce the law, and civil unrest can't go unpunished. The result of civil unrest is a more militarized police force.
So the question should't be "Why are the police becoming so militarized?" The questions should be "Why doesn't anybody know the law?" Rioting is illegal. Looting is illegal. Arson is illegal. Destruction of property, assault, all illegal. Protesting is legal, but this country is burdened with a bunch of troglodytes who would rather implicate violence in order to get a point across, which is ironically precisely the opposite of how one should go about getting a point across.
A mob who can kill an entire police force is a mob that needs to be forced into submission by the police. SWAT tactics work, so that's the style of policing police are beginning to use more and more regularly, and that is wholly the result of increasing civil unrest. If I see a mob walking down my street, burning my car, and scaring my poor defenseless puppy faced dog, I'd rather have a militarized police force throwing tear gas at them, rather then allow them to continue.
Bookmarks