[bazel] Exclude use_header_modules from some nanobind targets (#191898)

Excluding use_header_modules from some nanobind targets
diff --git a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
index cf07cea..e0afda3 100644
--- a/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
+++ b/utils/bazel/llvm-project-overlay/mlir/BUILD.bazel
@@ -1068,9 +1068,22 @@
     ],
 )
 
+# These flags are needed for python extensions to work.
+PYTHON_BINDINGS_COPTS = [
+    "-fexceptions",
+    "-frtti",
+]
+
+PYTHON_BINDINGS_FEATURES = [
+    # Cannot use header_modules (parse_headers feature fails).
+    "-use_header_modules",
+]
+
 cc_library(
     name = "MLIRBindingsPythonHeadersAndDeps",
     hdrs = [":MLIRBindingsPythonHeaderFiles"],
+    copts = PYTHON_BINDINGS_COPTS,
+    features = PYTHON_BINDINGS_FEATURES,
     includes = ["include"],
     deps = [
         ":CAPIDebug",
@@ -1097,6 +1110,8 @@
 cc_library(
     name = "MLIRBindingsPythonNanobindHeadersAndDeps",
     hdrs = [":MLIRBindingsPythonHeaderFiles"],
+    copts = PYTHON_BINDINGS_COPTS,
+    features = PYTHON_BINDINGS_FEATURES,
     includes = ["include"],
     deps = [
         ":CAPIDebug",
@@ -1107,17 +1122,6 @@
     ],
 )
 
-# These flags are needed for python extensions to work.
-PYTHON_BINDINGS_COPTS = [
-    "-fexceptions",
-    "-frtti",
-]
-
-PYTHON_BINDINGS_FEATURES = [
-    # Cannot use header_modules (parse_headers feature fails).
-    "-use_header_modules",
-]
-
 filegroup(
     name = "MLIRBindingsPythonSourceFiles",
     srcs = [