We can divide this thought experiment into two parts.
a. What is mediating the electromagnetic force necessary for both magnets to start moving (attracting/repelling) towards or away from each other?
Answer: Photons will be responsible for this mediation.
b. When does this mediation begin?
Answer: The mediation begins as soon as the electromagnet is turned on because electromagnet is already within the magnetic field of the permanent magnet.
As soon as the mediation begins, which happens as soon as the electromagnet is turned on, the electromagnetic force necessary to affect mutual attraction or repulsion of the magnets is generated. So both magnets start to move towards or away from each other simultaneously.