Not if you give it guidance for the architecture and don't just blindly let it one-shot after one-shot of huge chunks of the program.
Besides, AI can also be told to do the refactor.