The years was not spent on learning how to code. The years was spent on learning about what needed to be coded. And that would have spanned multiple domains. Even the most basic production level software have multiple concepts that need to be integrated. And for that, they need to be learned.
Using AI without the requisite knowledge is playing Russian roulette. It’s kinda wanting to log into a file, and not thinking about disk storage being finite, and rotating the log file gives you flexibility. That’s not related to coding, it’s just hard thinking about the problem and the constraints (or finding a good book or article).