You're describing a problem that's plagued corporate software development for decades. You just get to the "unmaintainable ball of mud" stage faster now. Every few days I spent a while on codebase architecture improvements after landing a slew of features.
That's a leadership failure not a technical failure. If you can't dig your heels in and force time to tidy up technical debt then you need to find someone who can and let them take over as PM.