Rationale: reduce use of gArgs to decouple code and simplify future maintenance and easier unit testing. This PR is continuation of work started in #18926 and #18662 It covers only places that register args in ArgsManager with AddArgs() or AddHiddenArgs().
Backport of core PR19561.
Depends on D8643.