The fact that net_processing uses a mix of mockable tand non-mockable time functions made it hard to write functional tests for #19988. I'm opening this as a separate PR as I believe it's independently useful. In some ways this doesn't go quite as far as it could, as there are now several data structures that could be converted to std::chrono types as well now. I haven't done that here, but I'm happy to reconsider that.
Backport of core#20027.