### Godot version

v4.0.beta17.mono.official [c40020513]

### System information

Windows 11

### Issue description

When using mono version of Godot 4 (beta 17), an exported **release mode** game executable will throw the following error if a `NavigationAgent2D` node is retrieved via `GetNode`:

```
ERROR: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.TypeInitializationException: The type initializer for 'Godot.NavigationAgent2D' threw an exception.
 ---> Godot.GodotObject+NativeMethodBindNotFoundException: Unable to find the native method bind. (Method 'NavigationAgent2D.set_debug_enabled')
   at Godot.GodotObject.ClassDB_get_method(StringName type, StringName method)
   at Godot.NavigationAgent2D..cctor()
   --- End of inner exception stack trace ---
   at Godot.NavigationAgent2D..ctor()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeConstructorInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Godot.Bridge.ScriptManagerBridge.CreateManagedForGodotObjectBinding(godot_string_name* nativeTypeName, IntPtr godotObject)
   at: godotsharp_pusherror (modules/mono/glue/runtime_interop.cpp:1227)
ERROR: Parameter "strong_gchandle.value" is null.
   at: setup_csharp_script_binding (modules/mono/csharp_script.cpp:1229)
ERROR: Condition "!script_binding.inited" is true. Returning: { nullptr }
   at: godotsharp_internal_unmanaged_get_instance_binding_managed (modules/mono/glue/runtime_interop.cpp:234)
```

If the node is continually referenced, like in a `_Process` override, the console is flooded with errors.

This error only appears to happen when the game is exported in **release** mode. Debug does not produce the error.

### Steps to reproduce

1. Create a basic scene with root type `Node2D`
2. Add a `NavigationAgent2D` as a child
3. Attach a C# script to the root node
4. In the `_Ready` method, assign the `NavigationAgent2D` like so: `GetNode<NavigationAgent2D>("NavigationAgent2D")`
5. Export the game in **release** mode (debug mode appears to work fine)
6. Run the executable from the command prompt, so that you can see error output. For example, in a CMD window: `.\MRP.exe`
7. Observe error

### Minimal reproduction project

[Navigation Agent 2D MRP.zip](https://github.com/godotengine/godot/files/10680472/Navigation.Agent.2D.MRP.zip)

}
				details[SNAME("owner")] = owner;
			}
			
			emit_signal(SNAME("waypoint_reached"), details);
			
			if (waypoint_type == NavigationPathQueryResult3D::PATH_SEGMENT_TYPE_LINK) {
				emit_signal(SNAME("link_reached"), details);
			}
			
			navigation_path_index += 1;
			
			if (navigation_path_index == navigation_path.size()) {
				_check_distance_to_target();
				navigation_path_index -= 1;
				navigation_finished = true;
				target_position_submitted = false;
				emit_signal(SNAME("navigation_finished"));
				break;
			}
		}
	}
}
void NavigationAgent3D::_request_repath() {
	navigation_result->reset();
	target_reached = false;
	navigation_finished = false;
	update_frame_id = 0;
}
void NavigationAgent3D::_check_distance_to_target() {