Backport 1/5 of core PR11466
(commits 0530ba0, parts of 8263f6a)
Note:
This PR first add changes to bitcoind.cpp, init.cpp and qt/bitcoin.cpp
(commit 0530ba0) then remove them in a later commit from the same PR
(8263f6a).
Unfortunately keeping this commits in different revisions would break
the cmake build when the wallet is disabled, in a way there is no easy
solution to prevent it. These 2 commits are mixed in the same revision
to avoid this. Because the mixed parts from 0530ba0 are reversion from
8263f6a, this should not make the diff more difficult to review.