`RecursiveDirectoryIterator` is a `\FilesystemIterator` so your fix does not have the same behaviour.