Edit: ...when successful.
In reality: are you a software engineer? Or do you know one? Surely you (or they) have experienced how difficult it is to write code that manages even a small number of inputs? Even 10 different yes/no inputs give you 1,024 possibilities.
Now imagine writing laws to precisely cover an effectively infinite number of possibilities, many of which don't exist at the time the law is written, and expecting the laws to cover these new situations and variables with absolute certainty and unambiguity. And unlike software, you can't just push a commit to prod to fix the problems as they pop up. It's a really long process, because democracy.
It's not happening, no more than you'd be able to handle a piece of software that took some infinite and random number and variety of inputs and did something useful with them.
We should, as you say, write "quality" laws to the best of our ability but there will always been a sizable human element to the interpretation of law.
Law has the advantage of much more advanced interpreters; but judges should still be interpreting the law, not guessing at the minds of the people who wrote the law. Lawmakers should be writing quality laws and fixing problems.
Judging by how hard it is for programmers to write bug-free instructions for literal computers, I'm not sure your expectation of flawless legislation is something realistic for mere mortals.
This encompasses every possible input including "what they believe lawmakers meant to say".
Edit: To get out in front of the obvious "Well what about when a judge just decides to do whatever they want??" response, I will say: That is why tradition, precedent, checks & balances, voting rights, and institutional trust all matter.
Gorsuch infamously ruled that the application of contract law (I guess, IANAL) was appropriate against a man who chose not to freeze to death by staying with his stranded work vehicle. I imagine a lot of other judges thought it was inappropriate and would have ruled in favor of the employee.
Taking into account what a judge thinks lawmakers meant to say also gives the judges a lot of wiggle room in their pronouncements.
Your list of 5 things that matter is commendable. However, the last 3 things have been torn to shreds over the past 4 decades -- and were never that strong historically, either in the U.S. or elsewhere. Tradition and precedent are easily side-stepped when convenient. And, of course, you have the infamous Supreme Court decision effectively placing Bush in the White House that explicitly said it was not to be used as a precedent.
And, of course, everything gets thrown out when corruption comes into play!
Judges are there to make the boundaries clear for the greyzone on what's not written down
The world is too complex to get perfect laws written. You're always going to miss weird edge cases in both directions
Ate they following things specifically as the law said they're supposed to, or hacking some edge case that isn't explicitly called out?