Answer:
The question has been answered by you already (but not well answered).
The rule governing the cooling down and heating up of objects can be found in thermodynamics.
Thermodynamics is all about the movement of heat; one of the basic rules of thermodynamics is that:-
Energy cannot be created or destroyed, it can only be moved or change form.
So, the moment you remove the pie from the oven, it first increases in temperature till it balances with the temperature of the oven.
Then it gradually reduces till it balances with the room temperature.
As seen in the attachment below.
Alphabet T and t represent temperature and time respectively.
Alphabet a shows when the temperature of the pie increases
Alphabet b shows when it balances with temperature of the oven
Alphabet c shows when it gradually reduces
Alphabet d shows when it levels with the room temperature