I went to university from 2005-2008. Back then, with dot-com scars still fresh in everyone's mind, an extremely common piece of "advice" I received was: Don't bother going into programming; software development is going to all be outsourced to offshore developers. You'll never make more than $50k/year in your career as a developer, the competition from India and Bangladesh will be too high.
As much as futurists hate to admit it, coding AI is still way worse at many things than even the now-near-universally-loathed "outsourced dev" boogeyman. Your job as a software developer isn't to write functions that reverse a binary tree or solve the Towers of Hanoi puzzle. I haven't seen any evidence that AI can evaluate a legacy codebase and determine what the best integration path forward is. I haven't seen any evidence that an AI can figure out how to put together a backwards-compatible API. I haven't seen any evidence that an API can put together a build pipeline.
Your question is based on an assumption that because ChatGPT can spit out some pretty impressive stuff that an entire career path isn't going to be viable. I will tell you emphatically that assumption is wrong. Spend a few years in the industry and you'll understand that ChatGPT is impressive, but only touches about 5-10% of what a software developer really needs to do.
It will be an important tool for developers going forward, and maybe reduce the overall number of devs needed in the world due to increased efficiency, but no, it's not going to replace software developers. Not even juniors.