Yes, I'm already doing it. But the problem is there's not a lot of incentive from management to do it.
Long term investment in something that can't easily be quantified is a non-starter to management. People will say "thank you for doing that" but those who create new features that drive metrics get promoted.
That's why it's very important to work for an organization run by engineers or former engineers when writing software.
And engineers who actually shipped and maintained successful products over time.
For software developed in-house by non-software organizations, the incentives are all wrong because management cannot properly assess the value of well architected systems.