Also, something else to consider, I kind of consider the automation of writing code not all that different from the automation of architectural and engineering drawings. No doubt some engineers were distraught when computers took the fun out of drawing, and professional draftsmen were devastated, but otherwise engineering is still viable enough as a career for parents to pressure their kids into studying it.
Perhaps a more realistic prediction of the future is that we start to identify a little more as designers, concerned more with the design of software and how it functions, rather than engineering concerns like making code performant and efficient.
I felt that software engineering as a career had a short shelf-life around 2020, but I wasn't too worried about it, as I figured I'd probably just transition to design as a career, I kind of think graphic design is cooler anyway. I began to have doubts about this plan once DALL-E caused an existential panic among illustrators, but otherwise I think it still has legs.
Those who adapt will probably do so by essentially becoming UI/UX designers who happen to also know how to code well, and probably know some other more general design skills just to round things out a little more.