Heat affects permanent magnets, not electromagnets.
It's the core of the electromagnet (rotor) through which the current runs that gets particularly hot.
If the motor uses permanent magnets at all, they are part of the stator, which does not get very hot.
The curie temperature of iron is about 1000°K. The insulation of the magnet windings may fail before the curie point is reached.
Magnets are usually wound with copper wire. The resistance of copper rises in proportion to absolute temperature. If the windings are allowed to get hot, they will then need more voltage to maintain the required field current. That will increase the power dissipated, which will heat the magnet faster. At 1000°K the magnet will be over three times more resistive than at room temperature. Keep the magnet cool.
The important equation when it comes to turning magnets on and off is V = L * di/dt.
To quickly get the current flowing in the coil of an electromagnet, a high DC voltage is needed. Once the required magnet current has been reached, the voltage should be dropped to maintain that set current. That will reduce the heating while it is on.
A parallel flyback diode should be used when the magnet is turned off. A resistor having a resistance similar to the magnet coil, in series with the flyback diode, will speed the reduction in current by increasing the negative voltage across the inductance.