The greedy pattern rewrite driver removes ops that are "trivially dead". This could include symbols that are still referenced by other ops. Dead symbols should be removed with the -symbol-dce pass instead.
This bug was not triggered for func::FuncOp, because ops are not considered "trivally dead" if they do not implement the MemoryEffectOpInterface, indicating that the op may or may not have side effects. It is, however, triggered for transform::NamedSequenceOp, which implements that interface because it is required for all transform dialect ops.
This isn't the kind of test that is high value, can you add a targeted test instead please?