test: Move (dis)?connect_nodes globals into TestFramework
Summary:
There is now only one callsite for these functions, so we can just move the code where it is needed.
I deviated from the original commit by not creating the ..._helper functions. It doesn't make much sense to define local functions that are used only once and immediately after being defined.
This is a backport of core#19967 [3/3]
https://github.com/bitcoin/bitcoin/pull/19967/commits/3c7d9ab8c8ec5284cdad1a53ee310b79b931f12f
Test Plan: ninja check-functional-extended
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D10560