The US, in fact, has a comprehensive federal and civil and criminal prohibition applicable to such behavior (the prohibition on deprivation of rights under color of law and conspiracy against rights), but the criminal prohibition is consistently inadequately enforced, and the civil prohibiition has been neutered by applying qualified immunity against it, which arguably is inconsistent with the letter of the statute.
I think one thing that is needed is a "viral" kind of law that criminalizes essentially all attempts to perpetuate, conceal, aid or abet the underlying malfeasance. So that if you can get some people wedged in who do want to do the right thing, they can bring the whole house crashing down by convicting the whole network of corrupt officials.
Ultimately you're right though that there does need to be some cooperation from "inside the system". The question is just what can we do do lower that threshold.
The only checks on any part of the justice system are from within the justice system itself, and its pretty hard to get those people to voluntarily cut their own pay, staff, benefits, and control in the name of justice, especially when it would most likely just get them fired and blacklisted. There are very little checks against what they do, and the people who have been involved with the courts and know how it works either benefit personally from it, or are considered a no-good criminal who's word is given zero heed. In most places if you get a felony you even lose your right to vote.
Source? This is certainly untrue for elected judges and DAs, so we’d expect to see a difference if that were the reason. Instead we see elected judges and DAs running on tough on crime pitches due to voter preferences. Not funding concerns.
Through someone in jail unnecessarily for a felony, and now you've taken a productive person and made them negatively productive (in jail) and destroyed most of their productivity when they return (nobody will hire or train them for anything valuable). Now their dependants, such as kids, also lack resources. Family lose not only their futures, but homes, health care, education, ....
Obviously prison is necessary in some cases, but other countries have low crime rates with far less incarceration.
(Reduced sentencing loads mean you can raise standards for court-appointed counsel, possibly ban plea deals, et cetera.)