Refactor recursion tracking in lib/ns/query.c
While #3147 (closed) was fixed with a change that should be safe to backport
(!5870 (merged) only touches statistics-related code), a number of problems in
lib/ns/query.c were identified while that problem was being
(!5882 (merged)) Code duplication.
(!5883 (merged)) Logically unrelated bits of code (e.g. prefetch and RPZ) share common code paths (e.g.
prefetch_done()) even though they do not need to.
(!5884 (merged)) Various features able to initiate recursion use common memory locations (e.g.
client->query.fetch), which forces them all to "cooperate" with each other even though they are all logically separate.
(!5885 (merged)) One of the overloaded variables is
client->recursionquota, which causes recursion quota to be handled inconsistently.
(!5886 (merged)) The
check_recursionquota()function needs to be cleaned up.
Unlike #3147 (closed), IMHO addressing the above issues is 9.19+ material due to the amount of changes involved.