I always thought the tapping is mimicing the arival of a mole thus scaring them out.
The tapping is definitely mimicking the falling rain. That's why you'll always see them wriggling around on a concrete driveway or patio etc after a decent rainfall. Lawn mowers can tend to bring them up as well.
I can't remember off the top of my head, but I'm pretty sure some birds mimic the falling rain and play the waiting game 😀