Since AI has gotten good, I've also done some of the rewrites to fix the past lack of budget/planning, hubris or sometimes devs who didn't know any better.
And worse, they're right - developing a feature can increase baseline profits more and faster than rewriting some old code can. The effects of software quality and the like are long-term.
But I can almost guarantee that all the unicorn companies we've seen in the past decades, the now trillion dollar companies, didn't become that because of code quality or diligence.
The core Dropbox idea was clearly good. But in order for it to really be a multi-billion dollar business it needed a platform that would support lots of users. Postgres: a pretty good idea. But it needs an underlying OS that provides things like processes and storage. iPhone: cool idea, made possible entirely by hard won engineering gains in processing efficiency, battery tech, touchscreen tech, cellular network buildout, etc etc.
Not literally everything can be product/profit thinking. There is a lot of engineering work underlying great products that yielded tremendous profits.