The very first cop show, Dragnet, was explicitly a PR move to rehab the image of the police in the public's imagination. Every cop show since has been propaganda. Even shows where the police are not necessarily the "good guys", like The Shield or even Chicago PD, normalizes police brutality and the flaunting of basic constitutional laws because those dastardly bad guys have to be stopped at all costs.
I enjoy some of these shows myself but it is sometimes crazy how blatant they are about it.
The Wire was very good at showing the police as the villains, but it also instilled a lot of pessimism into the audience because said villains got away with damn near everything. Jimmy and Ellis probably sent more people to the hospital or the morgue than anyone else in the show (either directly or indirectly), but neither one got more than a few days of unpaid leave and a reassignment as a consequence. It also undercuts itself by having Ellis become probably the most respectable person in the cast and having all of the cast tell Jimmy he's not to blame for multiple shootings, destroying both families he's built, and even framing multiple innocent people with life sentences.
So even the ones that try to buck the trend end up following it.