The mistake you're making is assuming that the single unit price of a low volume device like an industrial electric motor in any way reflects its component costs. High tech low volume engineering is dominated by R&D costs, one off manufacturing costs and margin. You could apply your logic (it would cost me $25,000 to buy one so therefore it costs Tesla that as well) to almost any item of consumer electronics and you'd find that your cost estimation was an order of magnitude (at least) above the retail price of a completed device. Try pricing a washing machine based on the cost of its component parts online - you won't be able to do it for anywhere near the cost in store.
When you build large numbers of integrated devices (be they washing machines, cars or cell phones), individual unit costs of components are always much lower. That's why we mass produce things.
The "mistake" you are making is that you assume Tesla has "invented" an electric motor, so rugged that it can withstand that riggers of being inside a consumer vehicle on the open road with a novice operator, in various environmental conditions, that is a fraction of the cost of similarly powered electric motors that operate in static environments, such as a factory floor, with experienced operators and fixed maintenance schedules? Wow.. I have a bridge to sell you...
When you build large numbers of integrated devices (be they washing machines, cars or cell phones), individual unit costs of components are always much lower. That's why we mass produce things.