Does one of the battery failure damages the UPS DC capacitor bank?
Electrolytic capacitors, especially aluminum types, have a limited life span. It may very well be that the capacitor failed to a short and placed a very heavy load on the battery preventing the internal charger in the UPS from being able to charge up the battery. As a result the battery fails.

It is also possible that UPS has a very crappy circuit design (many do). The battery could have reached a failed state at a very high internal resistance. A crappy internal charger may have increased its output voltage more and more trying to get the battery to take a charge. This would have placed a higher voltage on the capacitor bank than what the capacitor was rated for leading to a serious failure of the capacitor.