This is a completely automatic, unintelligent behaviour; if you remove the paralysed caterpillar at any point in the process the wasp simply goes on with its business (it will close its nest without any caterpillar inside, where the larva will die out from lack of food).
In the late 19th century, Jean-Henri Fabre studied these wasps (and many other strange insects) and had a copious correspondence with Charles Darwin on this very matter. His books are absolutely fascinating (ditto the letters Darwin and him exchanged).