Sorry to hear about your excitement, but glad the only damage was to the boat.
I assume you have standard flooded lead acid batteries--if not--then things are strange...
Just from normal charging, hydrogen is being generated by the batteries. It would be a bad assumption that a passive vent is sufficient to ALWAYS keep the battery box hydrogen concentration below the level that will ignite--given a spark. The problem is that hydrogen has such a very low flammable limit in air, between 2% and 6% depending on how you define it. Certainly local concentrations of H2 in the box could get that high in normal operation.
And a loose battery cable certainly can create the needed spark...
Moral of the story... battery cables need to be kept tight, and any kind of equipment added inside the battery box need to be ignition protected--or better yet mounted outside the box.
Annapolis, MD, USA