Depends, but it's possible: All vehicles I built were signed off by the licensing bodies & fully insured. We told both the lawmaker and the insurer about all our modifications and with some paperwork it was possible.
The community I linked above is full of people doing this kind of stuff. Some if it illegal, some of it legal.
Jailbreaking an EV I haven't thought about yet, but if the original manufacturer is bust, and you can show some degree of care to the licensing body I am sure it's negotiable.
Obviously it would be better to not be in this position in the first place, but problems are fixable.