Earlier quoted context omitted.
There's also the chance of it happening when writing a script Such as this classic: https://github.com/MrMEEE/bumblebee-Old-and-abbandoned/commi...
Ten years prior to that, Apple had a similar bug in one of its installer scripts on OS X. I have a hard time finding much about it online now, because it happened at a time when OS X and the Internet were a lot less popular than today, but what I recall is that an unexpectedly customized installation directory (say with spaces or one level closer to "/" than the default) would cause the installer to delete a whole lo…
so of course, I said "I'll just uninstall it from there and install it in the correct folder" and it proceeded to delete C:/Program Files/