The fact that software is embedded into a device that is sold does not preclude the copy of the software in that device from being licensed. See Apple, Inc. v. Psystar Corp., 658 F.3d 1150 (9th Cir. 2011). I believe the John Deere case and others have also made that quite plain.
With respect to the first-sale doctrine, I do not believe your statement is correct. With respect to your examples, they would specifically be in violation of 106(2) (regarding the creation of derivative works) and, in the case of a painting, 106A(a)(3) (though the latter is not directly relevant to the situation with Tesla insofar as software would not be covered by 106A). The first sale doctrine does not extend to rights other than those of sale or disposition, and disposition does not include modification. The Ninth Circuit in Vernor specifically referenced Autodesk's prohibition on modifications..
Just to be clear, I'm not opining on what one should or should not be able to do, but rather the specific scope of the first-sale doctrine as it exists today. With respect to modifications of software by users, I would imagine there might be some wiggle room under the fair use doctrine, depending of course on the purposes of the modification. But not under first sale.