Everyone is their own worst critic. I frequently am editing production code I wrote 15+ years ago. I also have to deal with the unintended consequences or side effects from my code that were not thought out at the time. It certainly is hard to teach this kind of thing and, more importantly, find a way to get people who haven’t experienced it to find the value in doing so.