Add ensure_backrefs helper for consistency checks