You are assuming AGI will come eventually.
I assume eventually the earth will be consumed by the sun, but I am equally less worried as I don't see it as a near future.
I am still regular dissapointed, when I try out the newest hyped model. They usually fail my tasks and require lots of manual labour.
So if that gets significantly better, I can see them replacing junior devs. But without understanding, they cannot replace a programmer for any serious task. But they maybe enable more people to become good enough programmers for their simple task. So less demand for less skilled devs indeed.
My solution - the same as before - improve my skills and understanding.