Compiled with some libstdc++ versions (e.g., on Ubuntu 20.04, Debian 11) std::filesystem:::create_directories() call fails to handle symbol links
properly.
This is a backport of core#24266
Note that this fixes also a redundant "/" being added to path when BaseParams().DataDir().empty(), so this is a dependency for D13730