Tesla only had to go Model S -> Model 3, just as originally planned, and they'd be much more profitable than today. Model X, despite its 25% margins or so, isn't making money due to manufacturing issues. Its too complicated with its Falcon doors, and doesn't really have an impact from a sales or marketing perspective.
Instead, Tesla spends billions ramping up Model X, only for GM Bolt to release before the Tesla Model 3. BMW and other companies are catching up as well.
Even the Nissan Leaf may release a 200+ mile model before Tesla's Model 3, all because of the delays incurred with the Model X divergence.
I really think the Model X divergence was a mistake. If Model 3 launched just a year earlier with more money in the bank, Tesla would be in a much healthier position.