Earlier quoted context omitted.
Ships carrying energy are a pretty easy explosive target as well. Local ressilence is needed in any case and mass produced batteries can provide that safety.
Diesel, iron or aluminum, from your parent post, are difficult to explode… (personally, no clue about magnesium); and the point of the latter two is that you can “store” energy by upstreaming its consumption when power is available, you don’t necessarily need to produce an actual reversible energy store.
Are you sure the parent isn't referring to something like a rust (iron-air) battery? Aluminum, Iron, and Magnesium are all viable battery chemistries.
Side note - I'm pretty certain you don't actually need to make contents of a ship explode to easily sink it with explosives.
I'm actually somewhat concerned that between drones and smart mines - we've never had a better chance of completely ruining our ability to do ocean based shipping during combat.