In Britain there is a common idiom for such circumstances: as if on cue or right on cue.
A cue is of course a prompt to act, and this phrase means that the actor has acted in time and in agreement with a prompt - except it is used jokingly in situations where the actor could not have been aware of the cue. In other words, the actor has responded appositely to the current context or preceding events without being aware of the significance of their response, just like you describe. It is often used in a sporting context.
The video in this Telegraph article is a brilliant illustration of the usage of the term: Blue whale interrupts BBC presenter right on cue - the timing is perfect.
Just when zoologist and TV presenter Mark Carwardine was bemoaning how hard it was to spot a blue whale, one managed to sneak itself into the shot right on cue
Here's an example from tennis, from the BBC:
Before the contest, I was courtside with BBC Sport's John McEnroe and Sue Barker and there was a huge sense of anticipation.
'Mac' suggested that a standing ovation would be nice and right on cue the crowd rose to their feet to greet Andy, 27, as he entered the arena. I think that definitely helped him to settle down and get into his rhythm so early in the match.
Wimbledon 2014: Andy Murray makes perfect start - Tim Henman. 23rd June 2014. Retrieved February 27 2016 from http://www.bbc.com/sport/tennis/27984213.app