#11626 race condition fix

[Filesystem Component] Fix mkdir race condition

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11626
| License       | MIT
| Doc PR        | none
You could move this line before the `is_dir` check, just to be sure that you really get the error from `mkdir` and not from `is_dir`

the condition should then be `if ($error && !is_dir($dir))`