I was taught that the danger zone is the temps where bacterica can grow. from 41 degrees to 140 degrees So yes, all food passes thru a danger zone while it cooks. When internal food temp passes 140 the bacterica begin to die off. Under 41 they go dormant.
The longer food stays in the danger zone, more bacteria is born. So yes, this applies to the temp of the food itself, not the surrounding area.