There's an obvious immaturity there too, wherein he responds to any criticism, hint that he may be wrong, or regulatory effort with the equivalent of a childish "you're just stupid!"
His battles with the SEC are a classic example, and it would be on-brand if this Twitter deal was as much about thumbing the eye of regulators as anything else. His announcement today had at one point caused a 20% dip in Twitter's pre-market price and 5% bump for Tesla's. The entire ride has been an exercise in manipulation.
So, I've wondered at times if a lot of this superiority act is really just deep insecurity, and he needs the world to constantly reassure him that he's as smart as he needs them to believe he is. When you look at the attention-seeking behavior you mentioned, it definitely aligns.