This is a problem with the state in general, and with unchecked and unmonitored authority. This is why people say ACAB. It's the unchecked authority you give someone (e.g. a cop, border agent, DA, Judges, etc) that create issues like this. It's a matter of removing and reducing authority as much as possible in these systems.
Until we realize that authority is the cause, we are not going to find a proper fix. Everything else is a reactionary bandaid on a systemic issue.