### 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)

return navigation_path_index;
	}
	real_t distance_to_target() const;
	bool is_target_reached() const;
	bool is_target_reachable();
	bool is_navigation_finished();
	Vector2 get_final_position();
	void set_velocity(Vector2 p_velocity);
	void _avoidance_done(Vector3 p_new_velocity);
	PackedStringArray get_configuration_warnings() const override;
#ifdef DEBUG_ENABLED
	void set_debug_enabled(bool p_enabled);
	bool get_debug_enabled() const;
	void set_debug_use_custom(bool p_enabled);
	bool get_debug_use_custom() const;
	void set_debug_path_custom_color(Color p_color);
	Color get_debug_path_custom_color() const;
	void set_debug_path_custom_point_size(float p_point_size);
	float get_debug_path_custom_point_size() const;
	void set_debug_path_custom_line_width(float p_line_width);
	float get_debug_path_custom_line_width() const;
#endif 
private:
	void update_navigation();
	void _request_repath();
	void _check_distance_to_target();
};
#endif