refactor: Extract util/exception from util/system
Summary:
This is a minimal extraction of a single function, but also the only use
of std::exception in util/system.
The background of this commit is an ongoing effort to decouple the
libbitcoinkernel library from the ArgsManager defined in system.h.
Moving the function out of system.h allows including it from a separate
source file without including the ArgsManager definitions from system.h.
This is a partial backport of core#27238
https://github.com/bitcoin/bitcoin/pull/27238/commits/e7333b420e35054d9302f9c58fd47b6152cbd35f
Test Plan:
With bitcoin-chainstate
ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D16149