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.