One very quick way for such to happen is a Low Electrolyte Level with the plates exposed, that IS a guaranteed fire.
Hydrogen in theory could do it too but it rarely builds up to such a level during Charge and I see on the right side of your box a vent pipe, so really Hydrogen should not have been the cause. It would also take an ignition so loose/corroded connections could do that but there would have been other issues beforehand.
WEAR Nytrile gloves and wash everything off with pure water & baking soda to neutralize the Sulphuric Acic.
When you separate the batteries, clean each one up well, look for any bulges, marks, cracks in the casing. Anything unusual.
Then check your electrolyte in each cell to determine the charge state of each cell within the battery.
Verify that posts are clean & intact, any melting "don't use". If a minor scrub with a BRASS brush cleans them up really well your good.
A Battery Operated Dual Mode Smoke detector inside the box can be a wonderous thing to save your backside. Make sure it's not far from your active venting.
When you rebuild / restore your battery box, seriously consider lining it with Magnesium Oxide Board. It is Fire/Water proof, higher rated than "fireboard" and 1/2 the cost. It's a PITA to cut (use a toss away blade in circ saw) and you can screw it on with regular #8 wood screws. Mag-O Board is available at most large building supply houses.
REF:
Magnum Board® One product, practically every application. Magnum Fiberglass Reinforced MgO Building Materials are a technologically advanced building material that offers superior performance in every…
www.magnumbp.com