As Churchill famously remarked, "the maxim 'nothing avails but perfection' may be spelt shorter: p-a-r-a-l-y-s-i-s".
You need to internalize the notion that this approach is unprofessional.
Or, as Jamie Zawinski put it (in "Coders at Work", recommended by Joel Spolsky once), "At the end of the day, ship the fucking thing! It’s great to rewrite your code and make it cleaner and by the third time it’ll actually be pretty. But that’s not the point—you’re not here to write code; you’re here to ship products."
And that contains an important observation. The job of a programmer is not to write code! It is to solve problems. If a problem can be solved by not writing a line of code, or even by deleting code - all the better.
See your job as one of a problem-solver, who only happens to be a coder. Not the other way round. A shift in priorities follows organically.
I am suffering from the same syndrome, but I cope with it by doing hobby projects, in which I have no deadline and I have my own little perfect world. (And yes, they typically end up paralysed by perfectionism). But at least thanks to that I'm venting off from all the rotten compromises I have to make at work, and everybody's happy :)
Thus my advice would be: try to write perfect programs in your spare time. You will learn that you're chasing a mirage and it's not worth it. Or you may get addicted to the thrill of chasing this mirage, but since it's your spare time, your professional reputation won't be exposed to risk, and you won't feel so perfection-hungry at your pragmatic, day-to-day work. Or perhaps you'll actually learn to write perfect programs in finite time. Either outcome is good!
If you absolutely cannot work on a solo project then how do you
explain it to your boss so that it doesn't seem like you're
incompetent?
Sorry to say that, but it wouldn't only seem so. It is a form of incompetence, fortunately one that can be dealt with fairly easily.