That is one way to handle it but without a reason that applies to the game world it would feel very artificial.
I don't think there would have to be any artificiality in the game. The player declares that the PC is (eg) trying to move the boulder. The die is rolled. If it fails, the ingame situation is that the PC has tried, and tried, but can't do it.
In the gameworld, the PC has retried. But the result of those retries has been resolved with the original roll. (So the retries don't actually get played through at the table.)
If there is no danger at the moment assume that the task will succeed eventually assuming there was a chance to begin with.
It depends what one takes the chance to be. In applying a one-roll-only/let-it-ride approach, then the die roll isn't modelling a "chance in the gameworld". It's something like a "chance the story goes the player's way".
Example: suppose the boulder DC is 20, and the PC has a +9 athletics bonus, so the chance of success is 50%. If the DC is understood as meaning "every time this PC spends a minute pushing the boulder, s/he has a 50% chance of moving it" then it
would be artificial to stop rerolls. But in a "let it ride" approach, the DC is understood as meaning "the player has a 50% chance for it to be the case that, in the gameworld, his/her PC is able to push the boulder, until there is some significant change in the circumstances."
You must have something specific in mind, I'd be curious to see an example situation where instead of a risk of being discovered, there's some other reason that automatic success/take 20 can't be granted.
The sort of example I have in mind is this:
The players are trekking through the wilderness. They come across a roadside shrine to Melora and Avandra. One of the PCs decides to pray at the shrine and leave a small sacrifice of money, in order to get a blessing for the rest of the day's travels. I (as GM) decide that if a Religion check succeeds on a Hard DC (at 1st level, this would be a DC of 19) the next Nature check made in the course of travel gets a +2 bonus.
Now there is no reason why a player can't keep praying and praying (paying every time, if the money amount is small). But it adds nothing to the resolution of this situation to let rerolls keep being made, or to allow the player to take 20 (I've already set the DC that is right for the scene). One roll will do the job. And I don't want to add the risk of wandering monsters in my wilderness to produce this result (for example, it might already be established in the fiction that the wilderness has difficult terrain but few dangerous creatures).
Another example: the players decide to search the shrine. I've already decided that a Perception check at Moderate DC (12 at 1st level) will find a runic prayer inscribed on the base of one of the rocks, which will give them a bit of extra information about the person they are hoping to find at their destination. Again, the DC has already built in the relevant probabilities. Allowing the players to make rerolls (or take 20) doesn't add anything to the resolution of the scene except muck up the probabilities.
Of course there are other ways to run the resolution of these sorts of scenes. I'm just giving some examples of the sorts of situations in which I
wouldn't take the approach of allowing retries and using wandering monsters to apply time pressure. They're just not scenarios where this sort of way of doing it adds anything.