Why do you think police have been militarizing so aggressively? They're clearly preparing for open revolt.
A number of factors have contributed, most of them unintentionally imo. Federal funding for example is a thing where if you don't use up all your federal funds allocated by years end, then your funding for the next year is cut. So cops go through insane military-level gear just to up the budgets, and everyone gets apocalypse level weapons and vehicles that belong in Mad Max.
Second is not to be dismissed, the bad guys are also heavily armed. Local gangs, Eastern European gangs, Asian, and South American backed gangs are all armed to the teeth, taking handguns in against paramilitary level gear is suicide. Much of the gangs are armed such to fight each other for territory and control, but they are less and less afraid every year to use it against cops.
Its not an impossible situation for us to back out of, and local leaders are making headway. We have to first de-escalate the war on drugs, that is the root cause of so many of our problems like gang warfare, high rates of incarceration in poor communities, lack of adult leaders for young males, and so on. Second is reforming the prison system so people aren't sent to jail for life for minor offenses, Obama has been working on that quietly and we see some of the 3 strikes type laws rolled back.
Third is re-working the entire police hiring and training system so its more the European model where their first response isn't overwhelming force but contain and question. This is going to be the hardest to change, since you need to get rid of thousands of senior people who will be unwilling to change and their bad influence continues to rot new hires. Since police departments are very decentralized, we'll see it slowly change in one city to another and its going to realistically take decades.
This isn't a problem that was created in the past few years, our zero tolerance policy we setup in the 80s has created a behemoth police state and its going to take much longer to undo all the things we thought were a good idea at the time.