This is a partial backport of [[https://github.com/bitcoin/bitcoin/pull/22937 | core#22937]] [2b/2g]
https://github.com/bitcoin/bitcoin/pull/22937/commits/6544ea5035268025207d2402db2f7d90fde947a6
The backport for this commit was split in to multiple commits to make review easier. This part deals with converting `fs::string()` calls that
will become unsafe when migrating from boost::filesystem to std::filesystem.
Depends on D10795