The heater core is used as a cooling system by-pass. The purpose of the bypass is to maintain coolant circulation during warm-up, to prevent cold or hot spots in the engine.
Heated coolant passes through the heater hoses and past the back side of the thermostat. Without this flow of heated coolant, the thermostat would be in a “cold spot” and opening of the thermostat would be delayed during engine warm-up. This is when you would see the temperature gauge climb to “Hot”, then back to normal after you stop the car and idle the engine.
After the thermostat opens and the engine temperature stabilizes, there should not have been a problem for the duration of your trip, but you said that the thermostat closes during driving. I have never seen a clogged heater core cause repeated temperature cycling while driving but i guess it is possible.