[v9_18] Resolve "stale-serve and RPZ put in SERVFAIL cache unexpected record"

NOTE: This was reverted in !7184 (merged) before the December 2022 release.


Backport of !7096 (merged).

Partial backport of !6417 (merged) to silence Clang Static Analyzer. See the following two threads for more information:

Closes #3678 (closed).

Edited by Michał Kępień

Merge request reports