Of course, it depends on your definition of quality, but for the sake of argument I'm assuming that we're including things like test coverage, code complexity, code cleanliness/readability, structural soundness (cohesion over coupling, the single reponsibility principle etc) and so on.
The point with all of these things is that as much as they might seem to be a waste of time when people can be hacking on something else, they (imho) save orders of magnitude more time than that in terms of maintenance of a codebase: being able to quickly fix issues as they occur; how quickly new developers can grok the codebase; how easy it is to add new features that were not part of the original design.
Unfortunately I have no hard data to back that opinion up, but it is what I intuitively believe to be true based on experiences.
It is dependent on the definition of quality. I'm not saying just throw crap code over the wall as quickly as possible! I've seen the consequences of that often enough. But I've also seen a lot of premature optimization masked as "quality", and at a certain inflection point, it becomes so time-consuming that it threatens the project.
For example, do you really need 100% unit test coverage of all corner cases?
If it is the front end to a banking app, or otherwise involved with account security, then yes. If it is an "Angry Elves" game with no login, then probably not.
As always, these memes are useful to guide/test our thinking, but not very useful if used without reflection.
In the initial stages of a product lifetime, you shouldn't focus on code quality. Releasing a crappy product beats waiting until it is well polished before releasing it, every single time.
But you should absolutely work on replacing, refining or polishing the crappy parts that turn out to be actually successful, or you'll end up in a dead end where you can't make your product evolve anymore without breaking everything. Or you'll get hit by the 'unlikely to be exploitable and difficult to fix' security flaws.
Crappy alpha code is good. Crappy legacy code, not so much.
Waiting for quality for release is always a mistake.
Release, refine and re-release. And A/B test, run the funnels and measure change as it happens.
Productivity on day #1 with bad code is a technical debt you take up - it will catch up to you if you ignore it for too long.
The day your app goes viral is not the day you want to learn about db sharding and data-architectures.
You'll want to grab all the users and keep them instead of 503'ing.
But if you do get past that phase, you can hire people like me to redo things and replace the bubblegum/fishing-line architecture with something more robust :)
However, if you're writing katamari code (that is, a tangled ball of garbage), you're sacrificing long term productivity. It seems like most people definitely don't err on the side of too high quality.
Oh, I totally agree (and +1 for the katamari reference. Your king will be around to insult you soon!). Most code is awful and doesn't meet even minimum standards. The industry error is strongly on the negative side.
I'm just arguing against the case I've heard from many programmers that better code is always better. At a certain point, you hit diminishing returns and lose sight of the goal.
I think it depends on how you define code quality. If you mean it's been re-factored (for example) as much as possible, then I agree. . .you are just polishing the apple. But if you mean acceptably (to the customer) bug-free, then I think your work was worth it.
If you spend an excessive amount of time on a problem, sure, you lose that time immediately.
The far more likely case is that your code quality is too low, which means you're sacrificing untold amounts of productivity later on. Well-written, self-explanatory code is a piece of cake for later developers to modify. Code repetition and counterintuitive naming has a good chance of wasting other people's time for no reason (if it doesn't bite you personally). In larger enterprises and startups alike, I suspect more productivity is lost revisiting badly-documented hacks than doing gold-plated "elegant" work for the first time.