This question comes up quite a lot, in this context and in other contexts. We like it because it makes us feel like industry leadership is being irrational and short-sited, and boy will they get theirs!
In reality, this isn't as much of a conundrum as it seems. As it stands right now, AI can't actually eliminate entry level programmers, despite the marketing hype. It might reduce the raw number of entry level positions in the industry, but not down to zero. So, the problem doesn't actually exist yet.
But hypothetically speaking, even if we did completely eliminate the need for entry level programmers industry-wide, here is the most likely way that would shake out:
First, the jobs go poof, people are laid off, unemployment rises, career transitions start happening, college enrollment in compsci drops significantly etc. Everyone thinks these are pre-shocks of a coming earthquake, but they are not.
After experienced programmers start retiring and demand for experienced programmers is on the rise:
1. the experienced programmers will be paid a lot to come out of retirement, even on short term contracts. And many of them will do this out of sheer boredom, since retirees universally learn that retirement ain't all it's cracked up to be.
2. businesses start looking to hire people with alternative experience, mainly open source contributions.
3. businesses apply significant political pressure to get more H1B visas for these positions, and succeed.
4. businesses can start hiring inexperienced programmers into experienced roles, almost always pairing them up with experienced mentors. THere is a productivity and quality loss due to this, but it also winds up producing enough experienced developers to keep things going.
And done.
Economic conditions change all the time, and people just adapt to them. Usually any kind of gloom-and-doom economic prediction is based on the belief that one specific thing will change while everything else in the economy is held constant. This assumption is never true.