If you're being paid to deliver code that means you're being paid to grant certain rights to that code. If the code is not a copyrighted work, you don't have rights you could grant. You therefore failed to deliver the agreed upon work and are in breach of contract despite having delivered "code".
As AI grows more capable, it becomes easier to fall short of the legal threshold for being able to claim copyright on the code you use AI to write.
Remember: copyright is very much about the actual text of the code - patents are about its logic. It's likely still possible to file patents based on code well past the point where you have a claim to its copyright. And of course depending on the kind of contract it can still be sufficient to deliver code nobody can claim copyright on - but you should definitely check with a lawyer before just assuming things.