Several years ago, I had a warehouse and required several cordless drills which I used for long durations. The batteries needed constant charging/replacements.
I ran across a company that told me they could replace the cells. I immediately jumped on the offer. when I received the batteries back. I could see that they pried the case open, replaced the cells and supe glued the case back together again. The batteries were equal or better than the originals.
That was during a time that no one offered a generic battery replacment. you simply had to pay the price for the original.
I currently have an Aostrimotor S18 with 2 batteries but when any of the 2 die, I plan to open the battery case, look up the correct cells and replace the cells
myself.
That is probably my road map.
Some basics:
The cells are likely either 18650 cells, or 21700 cells.
You need to observe how many are in parallel once the pack is open.
You need to know the peak current your controller draws.
Now it is time for cell selection.
Just for clarity, we will be using a 48v 20Ah battery for the example.
It is configured with 13 groups of 4 cells in series with 21700 cells. (13s4p).
If your peak draw is 40 amps. This means whatever cells you purchase must be capable of 10 amps of discharge current or higher. (4 X 10 Amps equals 40 Amps of peak discharge capability). If your pack is a 20 Ah pack, the cells must be at least 5000 mAh of capacity per cell (ideally more if they are available with a 10 Amp peak discharge current). Note: 5000 mAh is the same as 5 Ah.
With many cells, as peak discharge current goes up, they tend to have lower Amp Hours of capacity ratings. So you may have to carefully select to meet your goals.
You won't find any 18650 cells with a 5 Amp Hour capacity (5000 mAh), a pretty common capacity for 18650 cells is 3000-3400 mAh. This means you need more in parallel to get up to 20 Ah of capacity. 20 Ah desired, 6 cells of 18650 in parallel, required mAh would be 3333 mAh to get to 20 Ah of battery capacity. This would require a 13s6p configuration.
You may want to buy an inexpensive cell "spot welder" to make the electrical connections to the cells. There are eBay sellers who sell both the spot welder, and the thin metal grids for spot welding to the cells. Some will sell kits which have everything but the cells and the spot welder at a very inexpensive cost (Hailong case, Battery Management System BMS, spot weldable tabs/sheets), typically less than 30 US dollars.
You may not find a case which can support that many 18650 cells (13s6p would be 13 times 6 cells or 78 18650 cells).
My bike uses the "typical Hailong batteries". My wife's bike uses what looks like a less typical style of pack. It will definitely be a replace the cell pack.