Yeah but only software engineers care about "good" code. Everyone else just wants their software to do it's job. If you can train AI to write code which is going to get the right outputs, it will win.
AI can probably also beat humans in terms of things like performance optimization. An AI can write code a human never would. We have to write short functions and well-factored code which fits in the human brain. An AI could theoretically write millions of lines of highly-specialized spaghetti which is perfectly correct and perfectly optimized.