A referee may change his/her mind providing the games has not restarted.
There is no time limit like when deciding whether or not to play advantage.
In the ball goes out of play and I am then informed by my official AR that a defender slugged an attacker while the ball was in play the defender is leaving. We are going back for a FK or a penalty if the defender did it in the PA.
If the ball was out of play, the defender is leaving anyway.