There are sensors for battery temperature: my 2011 MacBook Pro appears to have two battery temperature sensors and a battery charger temperature sensor. It's quite possible that in this case the System Management Controller detected the overheating battery and shut down the computer - I'm not an expert on Mac hardware, though.