Those things already have very little space tolerance because the most important feature of any 'premium' laptop is that is as thin as absolutely possible and it is thinner than the previous model. All else is secondary. This would mean an even further thinning of the battery itself.
Correct me if I'm wrong but these incidents are sometimes triggered by charging, but never escalated by it.
Once the layers of the cell make contact it shorts the entire battery and causes the battery to discharge quickly, releasing the energy in the form of heat.
Just because you've removed the power source from the battery doesn't mean the battery won't stop discharging.
I've had plenty of batteries swell, and none catch fire before I got them replaced, so I have to think it could help.
In my experience Apple is not consistently good about dealing with this. In every case, I've ultimately been able to get the battery replaced at no cost to me, but with an iPhone 6 that started swelling about a year ago, pushing the screen out, phone support told me flatly that this wasn't something that could possibly happen with such a new device, and suggested that I try to make a Genius Bar appointment on my own. When I brought the phone into the store later that day, they replaced it on the spot, with no appointment. (I wasn't going to accept carrying around a time bomb for another week or more.)
Batteries (can, not always) swell quite a while before they "go off", so detecting swelling would be a useful sign that something is wrong and to stop charging to not trigger it.
A pressure sensor between battery and its enclosure could be used. Or strain sensors on the pack itself.
It should probably just disallow charging completely, as people have a tendency to ignore warnings.
It swells, the circuit goes dead, and that's the signal for the charger to stop charging.