I think most people who say "it would be rational to pay people to dig holes and refill them" say it only as a prelude to saying "and therefore, paying people to build useful infrastructure is surely even more efficient"
In the 1700s UK and Ireland, many rich people thought charity in the form of hand-outs was a bad idea and reward without labour was bad for character [1]. So some rich people who wanted to help the poor would hire them for things like building 'follies', extravagant decorative buildings and roads to nowhere. Having famine victims earn food with hard labour went about as well as you would imagine.
[1] https://www.amusingplanet.com/2017/10/irelands-famine-follie...