Yes, AI can write code but it can only produce product based on the INPUT A PERSON PROVIDES. Try it now...ask AI to write code to spin up a website with shopping cart and authentication and working with load balancing and so on. It will write all sorts of code BUT a person still has to either customize for specific environments OR the INPUT must be SO DETAILED that the AI produced output covers everything the business is looking for...is that possible? Of course, but you are still trading a web developer/DBA, for example, writing the code using premade blocks as well originally crafted for someone to craft the DETAILED INPUT that AI would use to create the same output normally done manually or semi-automated in most cases.
Planned Obsolescence is the term everyone needs to remember...when some jobs go away others begin. This is how technology works so if companies think they are doing away with humans and automating everything they are in for a rude awakening. I saw this firsthand with CLOUD COMPUTING....at first, wonderful, efficient, almost too simply. THEN, the bills came and suddenly companies had to readjust their thinking because the costs were much higher than originally promised and planned. Just saying....everyone should take a breath and not make assumptions that end up costing millions of dollars and the best talent in people.