Standardising the batteries so the connector imposes a certain level of safety would seem like a better solution than making it harder to repair. You can also discourage e.g. self made batteries through insurance policies like you do for cars and homes, i.e. you're not covered if you use a non-certified battery.
18650 cells are not like AA alkaline batteries. There are dozens of companies making them around the globe (maybe hundreds), and there are thousands of varieties all with different characteristics.
I've spent a long time in that community, and a golden rule is to never mix cells - even cells of the exact same type because they're often binned to be matched to be even closer in operating capacity. Also, and more relevant here, mixing old and new cells is also a big no no due to changing characteristics during aging and use.
You can't just pop open a battery pack and replace a bad cell. I mean, you can, but if you cause a fire that kills someone, you should go to prison for negligence.
I'm talking about replacing the battery as a whole, currently there are many form factors and you can't be sure you'll be able to get a new battery when the performance of the original one starts to degrade. If manufacturers would be forced to make it replaceable for X years at reasonable cost, either by providing replacements or by adopting an industry standard, that would fulfill the "right to repair" IMO.
You then want to extend that to the other main parts like the motor or the controllers, so you're not left with a piece of junk when one component fails. Just like for normal bikes.
It's not about repairing the battery by amateurs/diy enthusiasts, but the ability to replace the battery with another, compatible. It's not that hard to make sure that new battery meets the required parameters and has compatible connector, so any claim that only one, unique, model of battery can be used is BS. Instead of making stupid excuses producers should clearly specify what are the required parameters and if a battery meets these - should be allowed.
I don't think we should sacrifice the innovation and development of an entire industry on the backs of a tiny vocal niche of people who claim they want to repair their own batteries. If there was some standard form factor the entire last decade of the e-bike industry would never have happened. We'd be stuck with the Yamaha/Bosch/Shimano-style battery pack sitting inside the triangle, and we would not have the superior integrated systems of Trek and Specialized.
This isn't about about repairing batteries (eg replacing individual cells). Almost no one wants to do that, and that isn't the primary problem with reparability when it comes to ebikes. People want to be able to replace the battery, and do other repairs on the system themselves or with non-authorized repair shops, using high quality 3rd-party parts.
Many manufacturers make this difficult or impossible on purpose, and apparently they also have lobbied to change legislation to continue being able to do this, using battery fires as an excuse to cement their parts and repairs monopoly. It's that simple.
Let them innovate where they provide value - in the bike mechanics and drivetrain. But all their batteries are basically the same, built with same li-ion cells from same group of producers. The only innovation here is a proprietary chip making sure you buy only original replacement.