util: Avoid buggy std::filesystem:::create_directories() call
Summary:
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
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D13735