Yeah, AI will be responsible for major layoffs in the close future (in fact it already started in some sectors, like customer support).
I never would have thought programmers would be among the targeted categories to be replaced by AI, although yes, programming languages are just simple constructs for an AI to learn. You presented of course a possibility in which AI merely works as a puzzle solver, it has a multitude of real codeworks and it assembles them together to create a nice puzzle, better than a human programmer and more customizable to fit the end user.
The problem with this evolution is it generally creates more problems which are only addressed post-factum. Never or rarely in advance. So, we will have a work force problem... Who cares? We'll see when we get there.
We, as humans, are more determined to take action on issues which are perceived as real threats now. If it's 10 years from now, nobody will move a muscle. 1 year? it will make the agenda of a boring council. Tomorrow? It will be on the headlines of all media.
This made me laugh :)
I think many low-level programmers will be the first to go tbh, some may go into testing but with the competition of the many for much fewer jobs, the untalented will be left out.