Tesla and SpaceX have hired a ton of hard-to-hire talent. I don't understand why people might want to work for those companies because as far as I know the working condition is horrible. But again, his companies hire really good people to work on their problems.
From the software engineering side, it's still an opportunity to work on one of the highest traffic web sites on the internet. There's not a massive number of opportunities to do that.
They also made a whole lot of progress on those big problems before Musk's public face-heel turn.
IMO Tesla -- we owe them a bit, for revitalizing electric cars. Now that the big brands have come around, I'm not sure Tesla has such a huge draw (?). Like if you are an engineer, you could work on the same problems at Ford, but with fewer CEO antics, your designs will probably be implemented with better build quality, and I bet your employment would be more stable.
They're given the opportunity to work on big, macro problems (efficient space travel, energy generation/storage/security, climate change, etc). What's not to get?