Technology companies were right to care so much about vendor lock-in in the last two decades. In the past, developers were burned by IBM, Microsoft, and Oracle services, often with few alternatives and price gouging. But to align your strategy so vehemently against the same type of lock-in in the cloud era would be wrong.
Vendor lock-in still exists (switching costs will always be one core driver of competitive advantage), but the calculation is much different. Lock-in is a trade-off between portability/optionality and velocity.
The upsides are much greater – OpEx instead of CapEx means you can move much faster – doing more with fewer developers, no physical hardware to manage, secure, or upgrade, and scale when you need it. The number of developer hours that goes into building something as reliable as AWS Lambda or S3 can't be replicated by many other companies other than Amazon.
The downsides are mitigated. Software is more portable. Containers and Kubernetes provide some level of workload portability. The most critical pieces of infrastructure are often open-source. Code isn't as tied to hardware as it was before. Multi-cloud is still difficult but possible (compared to having to figure out how to integrate vendors on-prem with specialized hardware appliances).
Choosing only platform-agnostic features and designing your application to run every means no optimization. While optimization is fragile, you'll be missing out on potentially better performance or developer experience.
In fact, investing in your own bespoke infrastructure can create more lock-in than you'd find otherwise. A company that's built its own email infrastructure over the years will find it difficult to assess moving to Sendgrid or SES (it's hard to ignore sunk costs). Other bespoke systems might be better initially, but no company can keep up with the market forever (even Google).
As always, the right answer is somewhere in between. It probably isn't as extreme as architecting your application to be completely cloud agnostic, but it isn't using every high-level service your cloud has to offer (even if it's just for negotiating a better deal).