Many of the sensors in a $200,000 Maybach and a $20,000 Civic all come from the same battle tested catalogues from a few companies (like Bosch, Continental, etc.)
Tesla prides themselves on replacing those battle tested components with in-house alternatives with no where near the widespread applications or history to shake out bugs in order to save themselves some money.
I'm not sure why people think the EV part is what makes Tesla's margins when we've commoditized ICEs to the moon and back: it's the making a cheaper car part that does. You don't get to do that for free.