Facebook is a similar story: being the biggest website in the world is a core competency for them, and one of the ways they outcompeted rivals early on was by scaling their website better.
Uber has yet to turn a profit.
If datacenters are a part of your business proposition - not necessarily "we're selling datacenters to other people" but rather "we will be able to outcompete our rivals because our datacenter strategy will be better" - then self-hosting makes sense. But if the datacenter is a commodity from the point of view of your business - and I would assume that would be the case for Lyft - then it makes sense to buy off the shelf.
You have to rewrite application to use something else that's open source and self-hostable.
For new startups, I honestly recommend using DigitalOcean or Vultur. You don't get all the AWS components, but you can build around flexibility. If you have to move, you can take all your Terraform and Anisble scripts, and port them to a new provider (and yes, you do have to rewrite your Terraform config. Every provider is insanely different and the magic of multi-cloud is a myth, but it's still easier than trying to move off of AWS specific services).
I remember back in the day, Stackoverflow ran everything off of a single, very expensive, dedicated server. I've worked at other shops where we've migrated stuff from AWS to self hosted solutions to reduce our $200k/month AWS bill.
The trouble when people build things that have nothing to do with their core value propositions, they get locked into those services too. It is very easy for companies to get locked into their own homebrew garbage frameworks, clustering solutions, reporting & data analysis apps, or whatever else people hacked up because "omg vendor lockin!!".
I agree with you on Uber and Facebook though.
I strongly dislike the notion that on-prem hosting is somehow a bad thing, or too cumbersome, or otherwise totally solved by cloud providers. AWS specifically is hugely convenient in a number of ways, but it doesn't come close to the cost savings from running your own infrastructure. You need a pretty large amount of capital and engineering talent, but it really is worth it even in the short term (~3-5 years).
I think people would be shocked at what the money comes out to be if they saw costs from companies doing their own physical infrastructure. AWS makes you pay through the nose, seeing the difference would change a lot of minds I'm sure.