I use coco and I've never got them from brick coco. I have got em from bags of ready to use coco though. I think if you don't see them in the 1st couple weeks then they're probably coming from the environment. I do have them pop up a couple times a year. I think I bring them into the tent on my clothes from the wife's houseplants since she's always bringing new plants in and there's always gnats around her stuff, or the plants in the yard when it's warm enough outside
I've never cooked my media. I use potting mix to start and outdoors it's a combination of potting mix amended by 1st addition of ~30% of my own compost (hot composted leaves grass etc,) and then each new hole gets a shovels worth of composted cow manure, old soil, fresh pest 1:1:1. Once outside it's my belief/hope that between predators and they're such weak fliers Ive just me never had a fungus gnat issue (fingers crossed)!
Indoors is a while different story for me.
HF has definitely had it's fungus gnat issues, miracle grow mix I personally despise cause fungus gnats(and other reasons).
This last round I used these bricks of promix potting mix a friend who's the president of the local gardening club (avid avid Gardner) recommended for seedlings. Zero fungus gnats YMMV could have been a fluke (or a flounder hahaha).
My go to is mosquito bits sprinkled BTI . I add it to the top soil liberally every time b4 I see anything. My experience has been I don't see them for up to a week when I start. My thinking this means initially the populations low to start.
So far this has worked everytime over quite a few years for me.
The big box store garden centers potting mix have been my worst luck with these guys.
I see people with videos pouring boiling water, baking, putting outside and solarizing. So far I've never needed it.
It's my suspension that in part it's catching the little ##$&_$## b4 the population explodes.
I had them once so bad from.s cheapo bag of potting mix (ya I'm.a dumb ass) it wiped out like 35 to 50 plants and I didn't even realize what was going on till I was completely infested...
Just my observations your results vary.