I think one key was that I have gone back and read something that I wrote which I no longer remember writing that genuinely impresses me. I've stumbled upon my own answers on, say, StackOverflow, or found old posts on discussion boards before for topics I find interesting, or found some old scripts I wrote long ago that do something I now have need of. When I've had a question that needed an answer and discovered that my own answer from years ago is the best one I can find, it feels pretty good. When the argument I've used in the past is still well-reasoned, that also feels pretty good. When the code I used in the past was correct and complete and well commented, that really feels good.
No, not everything I've done before has been good quality, but it's a lot of fun to stumble on your own things that are good quality. It also makes it easier to forgive yourself for all the errors that you've made in your life.