[mlir] Fix `remove-dead-values` pass throws error when module has a name (#109990)
Fixes #107870.
We can allow the enclosing Module operation to have a symbol.
The check was likely originally not considering this case and intended
to catch symbols inside the region, not accounting that the walk would
visit the enclosing operation.