Something like that is done for firearms. It is illegal to sell firearms by mail so what retailers will do is sell a kit that has all the parts of a firearm except the part that is legally the firearm. Problem with your example is that the critical part that makes the collection of parts a firearm is itself legally a firearm. In other words, what keeps the state from defining that part as a "car"? If that part is now legally a car then you are back where you started, Tesla will have to get dealerships to sell the "car part" since it is defined as a car under the law.
Continuing the firearm analogy what people will do is sell an "80% firearm" through the mail. It is lawful to produce your own firearm. It is lawful to sell machined hunks of metal through the mail. So what dealers will do is machine a part that is really close to being a firearm but still requires the drilling of holes or some other critical machining to technically be a firearm.
Tesla doing something like this would be very difficult. They would have to sell a "car kit" with all the pieces required to build a car but lacking some critical machine work so that they are not technically selling a car. The problem is that while people that manufacture firearms for their own use do not have to register them, excepting places like New Jersey where state law requires it, every state requires cars to be registered to be lawfully driven on public roads. That means the person that assembles the car kit would have to go to the state and complete all kinds of paperwork so they can drive their car.
Requiring people to buy a Tesla car kit, assemble it themselves, and go through the paperwork to have it registered would likely have a serious impact on people willing to purchase it. I would also believe this would make a serious support headache for Tesla as they would have people calling about how they could not get their car put together correctly.
In short, people tried that already and the people that wrote the laws have undoubtedly thought of that too.