I agree police are a public good that society should maintain. The alternative is just a pile of bad ideas.
That being said, we, as in America, do a terrible job of maintaining our police force as a public good.
You talk about being "heroic" and "risking their lives", and that's technically true, but only for a very tiny subset, a larger subset is abusing their power and authority, and more crucially, never being held accountable.
Preventing all crimes is functionally impossible, although the incidence can be reduced in certain ways, but what we need is the criminals to be prosecuted. And a lot of police who commit crimes are not.