In mountainous terrain, particularly with a decent map, you can easily maintain orientation by observing the features around you. Typically you are ascending a ridge or descending a canyon. While the topography will not allow you to walk in a straight line, you will definitely not walk in circles. You typically have distant ranges, which when identified, keep you oriented.
It gets interesting in the slot canyons typical of the Colorado Plateau, where you are counting meanders, without too terribly much visible outside the canyon. However, you will not be wandering outside the confines of the canyon that contains you.
My feeling is that orientation by landmarks or celestial objects is more foolproof than a compass. I have seen compass variation of 45 degrees, while the North Star maintained its place. Of course, cloudy nights are another matter.
On the Channel Islands, the wind blows vigorously from the northwest about 95% of the time. It works pretty well to keep you oriented. Of course, you can only get so far off course on an island.....
_________________________
Geezer in Chief