The most likely way to escape the current madness might be for a few companies with more enlightened management to actively look for people who have stayed in past roles for long enough to have real experience not just building but also maintaining software and pay them more. Same with loyalty incentives to retain existing staff. And then make sure those more experienced developers are choosing tools built to do a good job and not just tools built to make naive resume scanners happy.
If frequent job-hopping and leaving any junk you've just built to become someone else's problem stops being the fastest way to boost your career and compensation then good people and good employers will start to prioritise building stuff properly and looking after it for the long term and almost everyone will be better off.
If you’ve never worked anywhere long enough to have to live with the fallout and consequences of your decisions, you’re not senior in my mind. You’ve never received useful real world feedback to be given a chance to refine your approach.
I feel like a lot of the problems are from misused Agile. Devs are building systems that haven't fully been thought out. I don't know when I've seen a fully built out process map in the past 5 years.
MVP1 is easily built as severless, but then what happens when the full implementation gets more complicated? Do we rewrite all the server less architecture as a monolith? Nah, just tack on some more Lambdas. No way can we slow down for a refactor, and all the original devs that wrote it have job hopped.