Don't rely on what anyone "tells you" about the warranty. You can get the facts right on Tesla's website.
Tesla Warranty Information
Note that is states that you can't buy an extended warranty if the car was purchased from a 3rd party dealer, but it never mentions that the original warranty is voided if you buy it from a 3rd party dealer. It also states that the original warranty goes with the car. These are the 2 pertinent pieces of information:
Does the New Vehicle Limited Warranty transfer to the new owner if I sell my Model S or X?
Your New Vehicle Limited Warranty will follow your vehicle and be transferred to the new owner
when a vehicle ownership transfer is performed through Tesla.
[no exceptions to this]
Can anyone purchase an Extended Service Agreement?
Owners (excluding 3rd party dealers and vehicles purchased from a 3rd party dealer) with Model S or X vehicles subject to the New Vehicle Limited Warranty which are still within the eligible purchase period can purchase the Extended Service Agreement.
[note the 3rd party exception]