bpf: teach refsafe() to take into account ID remapping