Leave to where exactly ... the company that writes perfect code? Little or no tech debt? Only possible in rare circumstances, probably when it is business critical that it be that way.
You are touching on an important point, which I did not state: that there are no companies with zero pebbles on the scale.
The goal is not perfection. The goal is to avoid a pile of pebbles large enough that engineers feel hopeless / "why do I bother" / "this place is a joke anyway". Good people don't stick around long for that.
But the main point was that thinking that a technical blemish has "zero cost" is a trap. The cost is not zero. The cost is having one more pebble on the scale.
From experience, there's very big differences between the amount of terrible decisions the upper management forces upon engineers between various companies. When it's very very bad, you should leave because the odds of it being better somewhere else are very high (they might be only average bad instead of objectively terrible).
Edit: It is also exactly this kind of thinking that keeps people in bad situations. Nobody wins when anyone thinks like that, except of course the people in the exploiting position in the first place.
No company is perfect, but clearly some are better than others from the technical perspective. I know I would enjoy my work more and remain more productive if I felt like I'm struggling a little, rather than a lot, to release anything.
You are touching on an important point, which I did not state: that there are no companies with zero pebbles on the scale.
The goal is not perfection. The goal is to avoid a pile of pebbles large enough that engineers feel hopeless / "why do I bother" / "this place is a joke anyway". Good people don't stick around long for that.
But the main point was that thinking that a technical blemish has "zero cost" is a trap. The cost is not zero. The cost is having one more pebble on the scale.