### Godot version

4.0.3.stable.mono, 4.1.beta2.mono

### System information

Godot v4.1.beta2.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Ti (NVIDIA; 31.0.15.2737) - 12th Gen Intel(R) Core(TM) i9-12900K (24 Threads)

### Issue description

NavigationAgent2D debug path is not appearing when the debug option is enabled. This used to draw fine when I first started working on my current project. I'm not sure what happened or what setting I've changed, but debug paths are no longer being drawn for any agent. Even when the custom path colour and size values are used, no path is visible.

Strangely, in the minimal reproduction project I've attached, adding a call to the nav agent `is_target_reachable()` seems to cause the path to be drawn. However, this still does not work in my main project.

It may be that I'm missing something here and would appreciate any help or insight into whats gone wrong as the debug path functionality was suuuuper useful when it was working previously. I can't seem to find any other posts online about this issue.

### Steps to reproduce

- Setup a navigation agent 2D as described in the Godot docs https://docs.godotengine.org/en/stable/tutorials/navigation/navigation_using_navigationagents.html
- Enable the debug option.  
<img width="349" alt="image" src="https://github.com/godotengine/godot/assets/19389664/44509b1e-6b6e-480a-a03b-c0c8eb529e35">

When the nav agent target is set by code, this should trigger a path to be drawn from the nav agent position to the target position yet no line is drawn.

### Minimal reproduction project

Run the attached project and click around the screen. No debug path is drawn.

Go into one of the attached scripts, NavigationDebug.cs or NavigationDebug.gd and uncomment the line that prints `is_target_reachable()`, rerun the project and click aorund the screen again. For some reason, this causes the debug line to be drawn.

[TestNavDebug.zip](https://github.com/godotengine/godot/files/11781387/TestNavDebug.zip)

I've tried adding in this function call to my main project in the hopes that it would begin drawing the debug paths again but no luck.
#include "navigation_agent_2d.h"
#include "core/math/geometry_2d.h"
#include "scene/2d/navigation_link_2d.h"
#include "scene/resources/world_2d.h"
#include "servers/navigation_server_2d.h"
void NavigationAgent2D::_bind_methods() {