I think the key question is whether it's really just "terrible code" - relevant only to people concerned about the code itself, rather than the functionality of the software. It seems plausible, at least, that terrible code has functional consequences you're not aware of. Maybe a lot of them, maybe complex and obscure ones.
It does seem to me that as of right now, AI is better at coding than most human coders if we just measure the success rate against some specific, well-defined, relatively simple test.
But in the past, talented coders used to make a large number of micro-decisions that they'd discover and decide while implementing any non-trivial feature. Making those decisions well was an important part of the job, and led to good software. It was also a somewhat rare skill.
I don't think AI writes "good software" in that sense, yet.
My concern is that, as of right now, the approach you suggest:
> Later I'll prompt "remove the dependency to python" it'll just do it.
Is actually not that efficient, because it means you're deferring all those micro-decisions to later, and constantly churning through some half-broken state of the program.
I'm not so naive as to suggest that this issue is somehow fundamental to AI; I'm just concerned about what is happenign right now and asking myself what the best way forward is.