But thats why you employ things such as body cams, proper training, periodical psych evaluations, etc. People who work in security and are armed for that end need that sort of structure, after all, they're just people, so there needs to be safeguards against their misbehavior. When someone trusted with that kind of onus fucks up, intentionaly or not, there needs to be swift and strong mechanisms to deal with that, something thats not always present.
However, I am a big critic of the general culture of hating cops because they're cops, which has spread around certain strata of western society, and also a popular political stand to suck votes out of people. Just like you said, these things do happen, but its quite a small minority. And yet, these cases get a fuckhuge coverage, meaning everyone gets that image of cops imprinted into their skull cavity, thus creating a general feeling of tension in cop x civilian situations. Hell, I personally know people that literally tremble and sweat when they're approached by cops, because all they see and hear about cops comes from word of mouth of their less than reputable friends and the media blasting them every single day about that one case of police violence that happened some weeks ago.
Whats even worse, is that this feeling of "cops vs us" makes cops themselves aprehensive and more stressed, maybe even to the point that they start approaching situations in a more fearful way. "Can I arrest this one guy in the middle of this neighborhood and not get swarmed by everyone around pulling their cellphones and filming what is only regular procedure?", "are these people armed?", "am I going to get murdered on social media for doing my job?", "what about my family? will they be targeted as well?", etc. This creates an incentive among cops to adopt conducts that aren't terribly professional, but that give themselves more protection from that kind of stuff. Having to shoot a perp that attacked you nowadays is good recipe for social suicide, so cops start to come up with MORE reasons to justify their actions, which can lead to rather shady situations.
Its a vicious cycle in which cops are only one of the factors, and not even the driving one.