High IQ is associated with depression and anxiety. So is introversion, which many software engineers tend towards. Software engineering as a career and maintaining a family can both be stressful. Stress tends to exacerbate depression.
They don't have to be stressful if the companies weren't practicing slash-and-burn methods at the behest of greedy investors and callous founders.
Not all companies are stressful and some are more stressful than others. Ideally this is something one evaluates when interviewing for a job, although obviously not everyone has the luxury of choice.