This PR adds a global mutex to `path_create_directories` to fix a thread-safety issue which can occur when concurrently creating multiple subdirectories with common stems. Pull Request: https://projects.blender.org/blender/blender/pulls/139266