I have yet to see a single developer lose their job to an AI. It might get bad devs fired, but like you said software engineers need to have robust problem solving skills. What people are calling AI today (which is not actually AI) simply doesn't have that capacity.
When people try to scare me with talk about being replaced I tell them this: good developers will simply move up the stack. Picture a software engineer with a fleet of AI helper agents. This is the future that is unfolding before our eyes.
When the automated loom was invented a bunch of manual laborers lost their jobs, got angry, and started smashing the machines that replaced them. Those people are now a historical joke. They are called Luddites. Don't be a luddite. Learn how to operate the new machinery. Simple as that.