The cognitive argument was more general; i.e. you're generally creative, not only when you're depressed - but there's a correlation between inhibiting general creativity and being disposed to depression and other such disorders.
It's, as you say, most likely a multifaceted case; there's more than one cause and more than one effect.
(but we're kind of straying from the topic, now P:)
Writing is a lot of things to me. In one sense, it's a release. It's putting all the interesting ideas I have, and getting them all out. It's crafting the characters whose voices speak to me and creating the worlds I wish I could explore. In another sense, it's a way of fighting. It's a way of creating characters like me, who are POC, who are LGBTQIA, who are outside of the exclusionary 'norm' of things. Writing my own work allows me total creative control, so I can tell the stories I want, the characters I want. So I can avoid a romance and focus on friendship, or create a romance that makes sense to me. I write because if I don't, I'll never see the stories I really want.