Lads and Lasses the time factor is irrelevant, first minute or last a foul is a foul, it's when the referee doesn't take the appropriate action is when he/she becomes derelict in their duty which we are seeing a lot of recently.
Regarding the scenario happening a referee cannot stop a foul happening if they, the player, decide he/she is going to do it. With the utmost respect to you all a referee cannot pre-empt things by stopping play because he thinks there's going to be a foul, that's pre-judging thereby compromising his impartiality. As stated above, it's when inappropriate action or none is taken is when any blame can be laid at the referees door.
A lot of our problems can be attributed to Fergusson when the FA allowed him to dictate who would or wouldn't referee their games, allegedly. Referees have the power in their hands to deal with the likes of Ben Mee and his ilk but for some reason or other, fear imo, choose not to use it.