We also have rules about welding car gas tanks, and for similar reasons.
One of the virtues of bikes is how easy they are to service or modify at home. It's great to tinker with motors, wiring, switching, transmission, and brakes. Unfortunately, LiON battery packs have invisible failure modes that involve burning down the building.