Salesforce literally has its own query optimizer, you are vastly underestimating the complexity of its software.
You seem to be implying Salesforce’s business is successful because they have their own query optimizer. But the causality is reversed. Salesforce has their own query optimizer because they’ve built a successful business.