Same here. Although it was rewarding to write "perfect" code, getting constantly hung up on the tiniest details was quite a soul-drainer.
Nowadays I see more beauty in the end product and refactoring. I still keep that idea of perfection in my mind and do my best to write good code from the start, I just don't let any of it become a blocker.
I'm more efficient, stress-free and productive as a result. And I don't feel as repulsed when working with other people's code.