I think it happens during use. I have had cell phones do this.
Batteries are hardware and break down over time, some faster than others depending on a variety of conditions including usage and charging practices. The overheating may be a product of poor discharge. Worth taking it to an Apple store if nearby or reputable repair centre for diagnostic test. Continuing to use it could cause damage to the device's internals and chassis.
AA
Sent from my iPhone using iPF