The previous logic failed when duplicate PBs explicitly specify their root transform. This change rewrites this logic and expands the cases in which PBs are pruned.