Source: I worked on Parrot's code. And you can make your mind by looking at the other projects in Parrot dev group...
Writing good code is not impossible. Or even difficult.
It just requires engineers to hold themselves to a higher standard.
For starters, engineers will disagree on what "a higher standard" means.
(Indeed, I've worked in industry sub-sectors where some of these best practices are widely understood to be counterproductive. Videogames often do few if any unit tests, preferring instead to rely on an army of human testers reviewing every build over and over because you can't generally capture the je ne sais quoi that is the feeling of "fun" in a test or even a design doc. By the time they've rapid-developed until they have a prototype that feels right, that prototype is the product and it doesn't make sense to add tests at that point because you can just test that one artifact to death by hand and ship it. This does, indeed, damage the reliability of the end product and result in something that often needs a week or two of follow-up patches... But because for all they complain, gamers don't actually stop buying games day 1 because of the bugs, the industry as learned leaving them in is acceptable risk that saves time).
If we shifted resources to supporting maintenance over novelty, this could change... But the people with the money want to make more money, and that mostly happens in the "come out with something novel and everyone gives you a buck" space, not the "keep the electrical grid control architecture running" space.
Incentives drive the industry.