The WSL case is the scariest of the three because it looked careful. The assignment was inside single quotes and set -u was there, but the shell that expanded $R was a different one. That is a good reminder that the safety check has to live in the same layer as the destructive command, which is why ${R:?} works when the other habits did not.
The other pattern across all three is that nothing printed the target before acting. In #95426 stderr went to /dev/null, so 35 minutes of deletion happened silently.
We designed CleanSync at Ascendra Ventures around exactly this fear. It wraps rclone to keep Google Drive in sync with your own server, and the rclone part is easy. The work is in the guardrails: every sync is rehearsed as a dry run first, and if the plan would delete more than a set number of files, it stops and shows you the list instead of continuing. Anything replaced or deleted goes to a Recovery folder first. For a tool that can delete, being able to say "this looks wrong, I am stopping" is the most important feature.
Do you think agent harnesses should refuse any rm -rf or --delete that does not use the :? form?