Sphex wasps, when they reproduce, paralyse prey and lay their eggs in/on it. When the eggs hatch the baby wasps have a fresh food source to give them a good start in life.
The mummy wasp digs a hole in the ground (they are commonly known as digger wasps) then goes off and brings back a paralysed grub. It sets it beside the entrance to the hole and goes into the nest. It is possible that another wasp has commandeered the hole. After a quick look around it comes back out and grabs the grub, drags it into the hole, lays its eggs, and leaves (covering the hole entrance).
This seems like reasonable and intelligently foreplanned behaviour.
If, when the wasp goes into the hole, you move the paralysed grub by an inch or two, it comes out, re-locates the grub, moves it back to beside the hole entrance, and then goes back inside the hole. It looks around then comes out again. If you have again moved the grub, and continue to do so, the wasp will be caught in an infinite loop of hardwired behaviour.