Whether it is the "right" way to handle this is besides the point, because this way is precisely the natural evolution of what has been occurring. It will always be the end result if injustices are allowed to continue long enough. And indeed, this sort of violence has resulted in meaningful changes to laws in the past. If police want to avoid this stuff, they need to functionally change their institutions - including the inherent racism hard coded into it - and begin to treat those they serve with respect and EQUALLY. But they don't. And this anger and violence will always be the natural result when those in power ignore your pleas for help against horrific injustices.
This being a sad result and not what anyone wants is besides the point, because a people will only suffer for so long before turning to violence. It's a story as old as time.