One way or the other you have to heat up the air again. The main reason this works is because air has very low thermal mass. Something like a thousand times less than typical solid materials. Even a small amount of solid mass is not going to cool down that much in such a short period of time.
I think there is one single factor why it is done and it is more energy efficient in comparison to keeping windows slightly open all the time for constant ventilation.
Rooms are mainly heated by water radiators in Germany. These radiators are most likely under windows to compensate for the radiated cold and draft from the windows that may create discomfort. As the heat moves up then it will create (mainly) closed circulation in the room when the windows are closed.
Now when the windows are open then the heat from the radiators will instead escape from the windows. On top of this the radiators are most likely locally regulated (with thermal valves) and will heat up because of the cold air from the outside while increasing the energy loss even more.
This is the main reason why the heating must be closed during the shock ventilation and why it is less energy efficient to keep the windows slightly open for constant ventilation.
This is of course a compromise between good air quality and energy efficiency and the correct answer is to build a proper mechanical ventilation with an heat exchange.
In modern buildings the heat recovery system in the ventilation transfers the heat from the outgoing warm air to the incoming cold air, which saves a lot of energy. The savings are big especially in colder climates.
(As a bit of trivia, the specific heat capacity of air is pretty close, +- 50%, to common building materials. Explained by the rather low density of air at normal pressure and temperature compared to those.)