It can also be an anxiety thing, if one has generalized anxiety disorder. The anxiety of doing something hard or with higher uncertainty (a challenging software problem) is high, and it takes the even greater anxiety of the high pressure environment to overrule it.
Worth investigating, because it seems like ADD, but it is not. ADHD drugs in this case can be counter-productive as they tend to increase anxiety.
There are techniques to cope with this that can be quite effective.