Earlier quoted context omitted.
Now run that loop 1000 times. What does the code /system look like. It is going to be more like evolution (fit to environment) than engineering (fit to purpose). It will be fascinating to watch nonetheless.
Sure, if all you ask it to do is fix bugs. You can also ask it to work on code health things like better organization, better testing, finding interesting invariants and enforcing them, and so on. It's up to you what you want to prioritize.
What stakeholder is prioritizing any of those things and paying for it out of their budget?
Code improvement projects are the White Whale of software engineering - obsessed over but rarely from a business point of view worth it.