The law means nothing. The law is "interpreted" by judges. If the government wants you to be guilty, they will find a way to make that happen. They don't care about the rule of law. The US has a 99% conviction rate, highest ever in recorded history.
You are misunderstanding the conviction rate. Only ~2% of cases actually go to trial, and at trial there is ~80% conviction rate.
There are ~4x as many cases dismissed by judges before getting to trial. And the vast majority (90%) of defendants enter into plea bargains.
Prosecutors only bring charges when they feel they have a strong case. There are many many cases which are never pursued because of this, and people also get upset about that.
Many countries do not have a plea bargain system the way the US does. And if you look at conviction rates at trial, they are smack in line with much of e.g. Western Europe.
That’s repeating the misunderstanding: the conviction rate is high because the government voluntarily drops or reduces charges when their case is weak. You have to think of it as “80% of the cases the government thought it would win” rather than “80% of all cases ever considered”.
What does lead to pleas is the expense of defending a case: if you acknowledge some guilt, you might decide to accept a lesser charge rather than exhaust your finances with no guarantee that you won’t get that lesser charge anyway.