fix `in-directory` for a non-#f argument, not inline `for` clause

Closes PR 14312