I think that this is purely an illusion due to a selection effect.
People associate (technical, scientific, artistic) talent and intelligence with mental illness because the people with mental illness that they are aware of have to have compensating qualities in order to be noticed, achieve notable things, and/or lead anything near a normal life. But the ones that don't, are essentially invisible or easily dismissed (criminals, homeless, not working, etc). It doesn't matter if you're a genius or not, you'd be better off not dragging around a ball and chain.