refactoring: Check IsArgKnown() early
Summary: This is a partial backport of Core PR16097 : https://github.com/bitcoin/bitcoin/pull/16097/commits/e0e18a1017fa3dc5d6ebeda6ec35c4263327d17c
Test Plan:
ninja all check-all
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D5753