Writers (like others whose primary tools are the mind+computer--for example, programmers) as a class probably have a higher percentage of people with mental issues or disorders than others.
Writing is solitary, so the problems might not cause as many problems as otherwise. Writing produces a product separable from the producer. Writers can create worlds and people different from themselves--they can imagine people with more, or fewer, mental issues than they themselves have. Today, writing and publishing can be done entirely online, by a shut-in, with (for example) agoraphobia. For a bipolar person, writing can be done during the highs and languish during the lows, and might not even suffer significantly, if the writer is not beholden to anyone for a deadline. Certain mental disorders can often create strengths out of weaknesses--such as how some autistic people are savants in certain niches.
One idea of a perfect world might be where everyone's mental differences were turned from weaknesses into strengths, and nobody was socially outcast because of these "abnormalities."