It probably wasn't the rmdir command that deleted the parent folder by itself, but the LLM did the traversal. The LLM probably did this:
rmdir D:\dir one\dir two\file
Detected that it failed, then the LLM issued the traversal command rmdir D:\dir one\dir two
And so on... rmdir D:\dir one
And then that failed, so... rmdir D:\