They can burrow for many reasons - one is to thermoregulate, another reason is to feel more secure.
As for the dirt in their mouth and heat pits - why would you be concerned about that? Are you concerned that they have not sufficiently evolved to deal with something so basic?
Let's put it this way - sticking it in the water and bathing it carries much more risk for that animal than a face full of dirt.
Do the poor thing a favor and stop flipping on lights in the middle of the night, poking around in it's tank and sticking it in the bathtub for midnight soaks. All of those things are stressful to you snake, and stress can lead to issues much more real and substantial than a heat pit full of dirt.