There are standards for sizes of screws, washers, motors, cables, plugs, sockets, ...
Just create a bunch more of those standards, e.g. for batteries, legislate their use, done. As a side effect, products become cheaper because parts will then be available off-the-shelf at economy-of-scale prices, and supply problems also become less likely because there will be numerous vendors for each part.
However, there will be two problems: some things, like cases and special moldings are hard to standardize. So I would suggest legislating that 3D-printing instructions (STL, material, finishing steps) be made available as soon as the part itself is unavailable or too expensive. And very innovative parts should be exempt for the first few years, provided they are measurably and provably better than the standardized equivalents and that a new standard is being created from them.