After a fresh install of VS 2026 I started encountering this issue, but only when I switched to Release mode. I had to go back into the VS Installer and:
Individual Components tab->Scroll down to Compilers, build tools, and runtimes
Then select the MSVC ### Build Tools you are building against
During my initial install I selected v141-v143 from the Desktop development with c++ tab, all of which should have had <filesystem> but for some reason they didn't install and it was defaulting to v140 despite me selecting ISO C++ 17 or ISO C++ 20 as the language standard.