The regex used to find the chain name in debug.log path did not work on Windows due to the different path separator.
This uses `pathlib` to make sure the path used for the regex search is `as_posix()`
This is a backport of Core [[https://github.com/bitcoin/bitcoin/pull/16973 | PR16973]]