Not academia, but my impression is that’s it’s a fragile self image thing - all their eggs are in one basket - “the smartest guy in the room.” Of course being the actual smartest person in the room isn’t possible, and at some level they know that, but they exhibit these behaviors as a way to try to assert it in the world, similar to narcissism. They need to be smart.
Why is it some common in CS? I can only guess but it’s a field where an entire individual can have outsized impact without the need for collaboration so it attracts this kind of personality. I think that will change, though, as the field matures. You look at Math, which should be similar, but it seems that collaborators are more successful than the lone wolves as many of the known problems have had many mathematicians try and fail to solve.