I'm not sure why you're calling SpaceX a vanity project. The company is already profitable, and if things play out like Musk is planning the company stands to make a lot of money. That's not a vanity project; that's a business.
Now, a Mars shot would be a vanity project if it were self-financed. But I doubt it will happen if taxpayers aren't willing to pay for it.