I agree on this point, the amount of time writing software is almost always going to be dwarfed by the maintenance period for software that makes it to production.
I've also seen businesses pay a lot of money software maintenance, but you seem to be implying that under-investment is a conscious choice. I would suggest that's not the main driver for software chaos.
The most common reason I've seen good software turn into an unmaintainable mess is knowledge loss / employee turnover over time. This usually results in a culture of fear around making changes to something that is poorly understood. When changes are made, they are done with incomplete understanding, and are consequently not in line with the original design choices.
Over time, even the maintainers move on. This continues until the whole thing is a complicated mess that nobody can understand, even the original author. That's when The Rewrite is suggested.