I think your mistake is in assuming that Tesla
only makes cars, and the number of them they make is the only factor that goes into their valuation.
They also have the world's biggest charging network, storage solutions, solar solutions and produce more batteries than virtually everyone else combined. Mercedes actually just put out a press release that said they can't build enough electric cars because they can't build enough batteries, because Tesla acquired the company they were going to use in 2016. Evidently Mercedes have done exactly zero about that in the years since.
Of course Tesla also have the whole "self driving car" thing they've been working on for a while. If they crack that one in the next ~24 months, their valuation will easily top Toyota's, because they're worth so much more than just how many cars they can build.