He’s Robert Heinlein.
That is, he’s one of the characters Heinlein clearly modeled on himself, such as Jubal Harshaw or Lazarus Long. The technology, the ego, the libertarianism: it all fits.
There’s one of these characters in pretty much every Heinlein novel I’ve encountered. They’re rich, privileged, and tech-savvy; they have enormous egos, and they distrust and dodge public authorities. They present themselves as fonts of wisdom and are surrounded by gorgeous women half their age, typically with Ph.D’s.
I’ll wager anything Musk grew up on Stranger in a Strange Land and The Moon is a Harsh Mistress. It all fits.