This is true, but it's also kind of vendor lock-in because there's a whole query language and aggregation pipeline for Mongo that's completely different to other databases. If I was using an RDBMS and was switching from MySQL to Postgres I think I would likely have a much easier time, because fundamentally it's all SQL (I know, there are differences between Postgres and MySQL, but it's a lot less, and a good ORM will smooth some of it out for you - at least initially)
I think this is basically equivalent to your example of not being able to easily move from AWS to Google Cloud because of their different APIs.
It doesn't seem like SQL-to-Mongo is impossible to implement, because there is third-party tooling for that (which I haven't tried): https://studio3t.com/knowledge-base/articles/sql-query/