Yes I freeze all hamster food! For a week. Because I did get an outbreak of bugs - food moths. From moth eggs that apparently are quite common in pet foods (virtually microscopic) and hatch out if it's warm enough. If you freeze the food for a week it kills any moth eggs (and any other possible bugs). Works a treat. But give it a full week. Never had any issues since.
I also think you don't get mites from bedding - it is probably just that people who have had hamsters with mites have had to freeze the bedding.
If you freeze the food you won't have any problems. I use Fitch substrate and buy it in a 10kg bag - it's recycled food grade paper - never had any issues whatsoever.
I think with any substrate if it's stored in a place where it could get damp - eg an unheated place like a garage - then anything could "grow" mould etc and that can encourage bugs in. So as long as it's stored in the house you'd be fine.
I even freeze any bark wood items for a week before using them, just in case, and the same with cork items. And also hay - now that has got a reputation for possibly having mites in so if you use any hay or items with hay on them, it's a good idea to freeze them.
With food I tend to get two bags - freeze them both, then get one out after a week (it defrosts in a couple of hours) and leave the other one in the freezer. Then when the first one runs out I get the one out of the freezer and order a new one which then goes in the freezer
Same with any hamster treats etc - any food that has been stored in a pet store basically.
Treats like sunflower seeds and pumpkin seeds are ok if they're human grade ones from the supermarket.