Tesla is not evil, but they sure can be clueless. I would bring this matter to Tesla's attention and expect them to make things right by taking back the car, or replacing it with the same or better without an accident record.
The tricky part is going to be convincing Tesla how much to charge for the Model 3 -> Model Y upgrade. I would argue that Tesla should apply the current market value of an un-wrecked car with your miles as credit towards the Model Y current pricing. In other words, you should have the ~ $49k of credit that a person with your car sans wreck could sell the car to Carvana.
Good Luck, OP.
Tesla erred, give them a chance to set things right.
It's been a long time since the corporate culture at Tesla was customer first. I bought a car from a third party, it was wrecked and repaired they told me, so I contacted tesla. "Oh yes, it's fine, you have a 50,000 mile bumper to bumper warranty, and an 8-year unlimited miles battery/drive unit warranty." So I bought it.
And Tesla honored the warranty, I had supercharging, everything for 200,000 miles and 5 years. Then all the sudden, after I retired and kept his car so that I could drive it with the free supercharging, they cut off supercharging. (And repairs, and warranty.) Contacted them and they said oh it's a salvage title. Turns out it technically was, rich guy no insurance wrote it off rather than get it repaired.
We lived in a titled hold state so I never actually saw the title. And Tesla did do warranty repair etc the whole time. A Tesla business resolutions rep even sent me a note saying "yes you're right it was under warranty when you bought it" and, effectively, "we made a mistake telling you it wasn't salvaged, it's your problem now".
I don't think anybody there at corporate really cares. The local people all tried. but I've contacted a bunch of people in corporate, had long email exchanges over a period of many months. Everybody ends up at the same thing "too bad it's not our concern". I even sent a registered letter to their lawyer in charge of litigation. That just brought me more months of delay.
I really want to hear back if you do get a resolution from Tesla, and would love the name of the person who actually put it together for you! Otherwise, sadly, I'm going to have to go the lawyer route. I've been trying everything in my power to make sure that doesn't happen, but I don't think it's possible.