

idk if this is a programming specific question. It feels more like “perfectionism” or a low-level OCD. For the programming piece, using some sort of task tracking system might be helpful. For example, after a task has been completed (aka a solution was found), move on to the next predefined task.
Another vaguely related term: premature optimization
I’d like to offer a reframe that’s been helpful to me, if I may.
The inconsistency will haunt you throughout your entire life, but only if you let it. Learning how to embrace and understand my emotions (instead of controlling [or suppressing] them) has been incredibly worthwhile to me. Therapy is a good avenue for this, but I understand it’s both expensive and not yet fully accepted by American culture. I also recommend the book The Tao of Fully Feeling, and here’s an excerpt: https://www.pete-walker.com/taoFullyFeeling.htm