As far as I'm aware, they can't withhold the warranty as long as the vehicle has been serviced by a competent outfit, according to the manufacturer's service schedule. I think that applies to all cars - EV or ICE. Quite how "competent" is decided, would be a matter for the courts. I think that's why some manufacturers insist on it being at least a VAT-registered garage, so that it stops your mate down the pub who "knows a bit about motors" from doing it. Obviously, if it's been done by a franchised dealer, the manufacturer has no argument. anything less, and it starts to give him a bit of wriggle room.
With no service history at all, then yes, I think the manufacturer could probably wriggle out of his warranty obligations. I think you'd need deep pockets to pay lawyers to argue otherwise - probably deeper than they'd have had to be if you'd just paid a main dealer to service it in the first place!