If the phone did not shut down it was not overheating. The phone has an overtemperature sensor that will shut it down if it gets close to the upper (or lower) limits of 0ºC to 35ºC.
If you are restoring a backup the phone will get warm as both the data transfer and writing to storage use a lot of energy. Once it has restored give it a day to finish "housekeeping." If it still gets warm go to Settings/Battery to see which apps are using the most energy.