Yeah, on top of that add wading through legacy code, figuring out why wtf, this is crap, just to figure out most times it is actually crap, but then at least equal amount of times that there was a very good reason to do it that way, either technical or by business logic... cannot imagine how any AI system could have success there without getting towards the true AI singularity.
This kind of code that I'd believe makes up 99% of all code out there that is worked on, is not available to the public for training. What to do about that? Rewrite all?