Such special cases are not covered specifically in the rules. (RAW lacks specific language for it).
So, it is up to the DM.
One "simple common sense" approach that I've seen applied by several DMs (as the "polymorph back to my true size while inside a strong enemy" is seemingly a surprisingly common rules exploit, the same as "drown it with Create Water", or "blind it with Light", and lots of others) goes like this:
Think if you cooked some raw muffin paste in a small cardboard in the oven. As the muffin paste volume increases to become muffin-shaped, the end result could be that the box rips apart a bit or even a lot (as in: some damage is dealt to the box). But the muffin itself would also definitely end up coming out of if really weirdly shaped (as in: some damage is dealt to the muffin too).
The player in the original question basically wants to come out as an intact pristine muffin, with a completely torn to shreds cardboard box. Letting him do that would just open the door to completely ruin campaign game balance, so obviously the DM has to make some ruling somewhere.
However, despite "up to the DM" being a valid RAW answer (per the DMG "master of rules" section and PHB p. 6) inside the Enlarge/Reduce, Wild Shape, and Polymorph RAW powers' wordings, the RAW rules show hints that no harm comes from using them.
Becoming bigger only goes up to the available room, not leads to crushing damage.
Equipment appears / disappears merging seamlessly and harmlessly.
Mouth and stomach content also seem to appropriately change harmlessly. Otherwise, with the mere act of turning into a fly, whatever little water was in your mouth as a humanoid PC, would then be several times the size of you as a fly, most of it quickly gushing out of your mouth in all ways possible: outside of your mouth but also right inside your lungs, too. Thus, you'd end up as a rather drowned fly.
Or, whatever food was in your humanoid stomach, even an almost unchewed and quickly gulped down hamburger bite you just took the very round before, would end up being a huge amount of food compared to the size of fly, and thus would simply explode the fly's stomach (and the rest of the fly too). That water or that food are not "objects" (and thus not "gear") as defined by the rules, because objects have to be discrete things. Thus, there is a precedent for how to deal with "non-gear" matter on or inside a creature: No harm seem to be hinted to happens from such things.
In the same vein as the above "RAW hints", no harm should result from potential polymorphing hijinks when one creature is inside another.
If the DM is feeling permissive and wants the Rule of Cool and/or the Rule of Fun to apply in a stronger way than mere RAW indications seem to hint at, he should keep in mind the RAW "Damage Caps on Spells" in the DMG. Don't let a (for example) Level 4, utility spell becomes an insta-kill-no-save attack spell!
And don't give to a utility spell the same damage as a pure attack spell: allow for the fact that those damage caps are for spells that mainly only do damage, not for spells that you allow to end up doing damage plus utility.
Finally, remember to require a Saving Throw somewhere. The number of "no to hit no saves" spells are extremely limited in the game, for good reasons.