SpaceX's success is easy to explain: they could do the same task as competitors for a substantially lower price.
As for Tesla's market success, I think that's predominantly driven by the product itself. They won countless car of the year awards. Customer satisfaction levels at near-unprecedented levels. Record-breaking 0-60 times provide an angle for gushing media coverage. And a decade of having no competitors in the market subset of desirable EVs. I've personally never heard anyone mention Elon when describing why they're interested in—or purchased—a Tesla vehcile.
They also intuited/gambled/stumbled upon (pick your verb depending on what you think of it) that “electric and fast” was enough to compete against non-EV cars with much better finish.