It's useful to remember that general intelligence does not imply emotional intelligence, and it's natural for smarter people to realize their insignificance in the vast and uncaring universe, and run into a number of basilisks the rest of us never notice. As humans, we create our own meaning. And yes, CBT can be very useful to get out of depressive philosophizing.
Nietzsche isn't a great example. His health was dreadful throughout his life, and it's really astonishing how good his mood and vigor were, given the crippling nature of his ailments (until his ultimate collapse). Philosophy in his case was probably a mood booster and a good coping mechanism.
There are lots of paths you can choose to wander down in philosophy. If you suffer from depression, one of the symptoms is that when you reach a crossroads in this wander, you'll choose the path that leads into the dark dismal swamp of nihilism and a dark uncaring universe with no meaning or point. That's not philosophy's fault, that's depression's fault.
But "dwelling on stuff" in general probably isn't a good strategy for dealing with depression, so if you're spending time philosophizing that you should be spending exercising, improving your diet, socializing, making doctor's/counselor's appointments, checking things off the basic-life-tasks to-do list so life doesn't get overwhelming, etc., then you might want to take a break.
Epistemic status: Weak confidence. Refine and dismantle as you see fit.
For certain people, philosophical thinking is net harmful to their everyday life.
This should not be that surprising. Certain kinds of cognitive behavior do reliably lead to unhappiness, and there's no a priori reason to suppose explicit, logical thinking is somehow exempt from that risk. For many people, it appears that a stable sense of identity, purpose in life, and place in society are important factors in creating and maintaining happiness and contentment. Philosophical thinking often involves destabilizing those concepts.
I want to point to something I have noticed in myself, and suspect happens in others as well. I call it "depression philosophizing." You begin to think philosophically about your life, and slowly, maybe imperceptibly, you feel worse and worse about yourself, as you meditate on such concepts as morality, meaning, and ontology in an abstract sense.
It's tempting to unilaterally demonize depression philosophizing. But there is one big thing about it that stands out and that makes it so hard to quit doing - and that's that the quality of your intellectual rigor doesn't correlate very much with your emotional state. Plenty of great philosophers were miserable people (Wittgenstein, Nietzsche, Schopenhauer).
I think rationalists are likely to fall prey to this trap. As a group, we have a revealed preference towards abstract thinking and philosophy. Some of our folk heroes appear unusually good at facing philosophical problems without letting it get to them or divert them from their goals - Nate Soares pops to mind for me.
I don't have a good answer for how to combat this beyond the usual mechanisms used to treat depression. But I've had some success at simply reminding myself that even the act of stopping and thinking has an opportunity cost to it - it's not actually a very wise move to devote large amounts of time running your brain in circles around a tempting philosophical issue when you know people have tried and failed to answer it conclusively for thousands of years. Sometimes I even accept the maxim "ignorance is bliss", in this small domain of human experience. These experiences remind me strongly of cognitive-behavioral therapeutic techniques. I hope this helps someone else who grapples with depression philosophizing to start reclaiming ground from their own disastrously clever mind.