You deal with it using AI. The difference is that you can provide better guidance than someone with inadequate development experience. Better guidance leads to a better (ie cleaner) result.
You might as well get good at this now, because the future is AI generated code and AI assisted code maintenance. And by the future, I mean the present.