You can buy a battery build kit for M18 tools (for example) on AliExpress that comes with everything but the cells.
I'm a bit of a tool nerd and I'm not aware of any power tools that are doing DRM in their tools to prevent usage of third-party batteries but I don't mind being wrong so I know which brands to avoid.
I also have Gold mount and V-mount type batteries that I'd love to have the cells replaced. If you think power tool batteries are expensive, take a look at film/video batteries!
(I should probably pick one of these up before Torque Test Channel does a video on them and they end up getting sold out for a year.)
Edit: I'm referring to the PDNation universal battery + brand-specific adapter in particular.
Mixing old cells with new can lead to a runaway thermal event in the worst case (i.e. unstoppable cancer-causing fire).