This is the basis of CBT (cognitive behavioural therapy).
Rewrite the negative loops of thought with constructive ones.
Perhaps CBT is effective precisely because it's a kind of middle-ground. It's hard to describe, but CBT sometimes felt like bug-fixing when perhaps refactoring the whole thing was in order.
But then again in my daily life I regularly face the difficulty of choosing between fixing bugs and rewriting the whole thing, and I haven't found an easy answer. Try one, and if it doesn't work try the other?