Backport last relevant bit of #11389
Summary:
Most of #11389 was irrelevant except for D3366. This backports the only
other possibly relevant excerpt that may help to keep code in sync:
https://github.com/bitcoin/bitcoin/pull/11389/commits/d618458184742b15a7ab0349127ede7a2946a182
Test Plan: test_runner.py with ZMQ support
Reviewers: Fabien, #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D3388