Because right now it leads to symbol conflict from binary builds.
Use of `std::filesystem::file_exists` was introduced by https://github.com/pytorch/pytorch/pull/126601 and in this PR it is replaced with a very straightforward implementation that calls `stat` on the given path, which is a classic C-way of checking for the file existence.
This PR should be reverted once one figures out how to keep `std::filesystem` methods linked into the binary private
Fixes symptoms of https://github.com/pytorch/pytorch/issues/133437
Pull Request resolved: https://github.com/pytorch/pytorch/pull/134494
Approved by: https://github.com/atalman, https://github.com/d4l3k
Co-authored-by: Nikita Shulga <nshulga@meta.com>