So - it isn’t just function of the phone... it is a real safety issue. Again - this just reinforces why Apple was totally justified in taking the steps they did.
It could be. . . although the batteries Apple usually uses do not have chips in them that fail to do the safety shutdown that would allow this bad a result. It can happen.
The expected catestrophic failure rate of Lithium Ion batteries is now about one in 8 million per year. . . so even with Apple with 1.2 billion iOS devices in the wild with Lithium Ion batteries, we should expect ~150 catastrophic iPhone/IPad/IPod Touch device failures per year which would result in massive swelling, fires, or explosions. For example, there have been about 30 million iPhone 8/8+ models sold since September's release and three have been reported to have swelled batteries. That's a little ahead of the expected number per year. . . but they are under investigation at this point.