Commit c53c983 introduced the utility function get_datadir_path, however not all places in the code use this util function. Using the util function everywhere makes it easier to review pull requests related to the datadir. This commit replaces datadir path creation with the datadir member of TestNode, which itself uses get_datadir_path.
Backport of core PR12076
https://github.com/bitcoin/bitcoin/pull/12076/files