How to make a 10 year old electric bike battery work better?
As said, the batteries need replacing. They have a limited lifetime, regardless of use. You don't say if they are lead acid or lithium - if lead acid, they will certainly stuffed.
If Lithium they could last many more than 10 years, but only if stored correctly.  If replacement batteries cannot be purchased the best option is probably a rebuild. Virtually all battery packs are made up a collection of standard size cells, a rebuild involves stripping the battery and rebuilding with new cells.  Cell quality and price varies a lot, so shopping around for the cheapest is not always the way to go, but paying more does not mean you are paying for better quality cells.  When selecting a rebuilder, ensure they specify the cells they will be using - ideally a branded named once such as Panasonic or Sony, sourced from a reputable supplier. There are  a lot of counterfeit and low quality cells being sold these days.
Changing the connectors to use a different model battery pack is also an option, but you would need to know what you are doing. By the time you source a new battery and installed matching connectors you are likely close the cost of a rebuild.