The result is that, as an industry, the Internet and the world's business are held together by twine, twist ties, and spaghetti code. Even this very webpage is just enough to work for most people a lot of the time.
(but... I'd be jobless if that were to happen :(
The terms are somewhat contentious, but AIs are more prone to use heuristics than traditional algorithms, which would add another layer of complexity.
So, we can't be certain that such an AI itself wouldn't create bugs. If anything, it would be easier to show that bugs would get created.
This is simply the state of software. We all deal with it in the ways we can, trying our best to minimize issues and add value.
Contracts, like they have in Racket, might also be interesting. They only fail at runtime, but it's easy for mere mortals to express interesting invariants and get good 'blame'.