I don’t know. Mine doesn’t get hot when its not on the charger, so it sounds like your problem is slightly unusual. Cause when I first got my phone it kept getting hot on the charger, so I took it to the apple store and they said that this was normal that, instead of keeping all of that heat inside the phone and damaging it, (kind of like you said) the iPhone sometimes cools itself by pushing that heat outward.
Oh and by the way this only happens when its plugged in, and I’m using the phone. Ex. Using Internet, listening to music, texting, etc. Like I said before just take it into the store if you’re that worried about it.