The smart reason graphing calculators are banned is because students are meant to be learning a concept. You don't learn how to graph to pass a test you take a test so you're pressured to learn how to graph.
Same with AI. Having AI generate a for loop doesn't mean you understand the concept of a for loop. You can argue that it's a waste of time to learn about for loops because an AI can write one for you but that's a separate matter.