hooks: detect ref changes at gc --auto time