[net/refactor] Rework ThreadOpenConnections logic
Summary:
Make the connection counts explicit and extract into interface functions around m_conn_type. Using explicit counting and switch statements where possible should help prevent counting bugs in the future.
Partial backport (16/19) of core PR19316:
https://github.com/bitcoin/bitcoin/pull/19316/commits/7f7b83deb2427599c129f4ff581d4d045461e459
Depends on D8725.
Test Plan:
ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Subscribers: majcosta
Differential Revision: https://reviews.bitcoinabc.org/D8726