Prosecutors aren't evaluated on doing the right thing. They are evaluated on their conviction percentage. How many cases ended in conviction seems to be all that matters. And, when your salary, your future promotions, and even your continuing in the job depends on winning, some choose to do what they need to do to win. This goes from the new assistant prosecutors handling traffic court through the guy elected as the head of the office. You don't see adds talking about how the prosecutor protected the rights of a criminal. You only see adds talking about wins. Sad truth.
Another root of this evil is the rampant plea bargaining that goes on throughout the system. Prosecutors over charge cases. Defense lawyers refuse guilty pleas in an ongoing effort to get an even better deal. This makes the problems worse by not exposing all of the wrongdoing. Instead of the story coming out, the case gets plead out, and the problem just fades away. If prosecutors had to go forward on what they charged, they would be much more picky about filing charges. Cases with evidence issues/Constitutional problems would get no billed because the prosecutor would be facing a situation with no plea bargain to use as an escape from the problem. I know I hear all too often prosecutors file a charge with no real hope of prevailing at trial, but rather to use as a starting point in negotiations.
I know. I sound like one of the old guys. It was better back in my day. But it was. There was a no plea bargaining policy when I was a prosecutor. Adopted by the elected prosecutor and enforced by the judges. There was also an open file discovery policy. Elected prosecutor didn't want his people wasting time fighting about what should and should not be turned over. You just turned everything over. Made life a lot easier. And honest.