[9.20] fix: dev: Use attach()/detach() functions instead of touching .references
In rbtdb.c, there were places where the code touched .references directly instead of using the helper functions. Use the helper functions instead.
Forward port from https://gitlab.isc.org/isc-private/bind9/-/merge_requests/753
Edited by Ondřej Surý