What is the intended way to get the full navigation path between two points on a TileMapLayer?

Godot Version

v4.4

Question

For context I am using a TileMapLayer, with multiple navigation layers set up, and NavigationAgent2D on the relevant node. Also, even though I am on a TileMap, I did not set up an AstarGrid or anything like that, as I don’t want to restrict movements to exactly the tiles (maybe this was the mistake?).

I was trying to visualize a navigation path for my prototype, when I ran into the issue of get_current_navigation_path() returning empty. As I kept looking into it, it became weirder, as the following code:

print(nav_agent.get_current_navigation_path())
print(nav_agent.get_next_path_position())

printed out an empty array, but the correct set of coordinates for the next position.

Looking into it a bit more I found this in the Godot implementation: basically the path is generated when I call the get_next_path_position() method, and it is not filled when I call the get_current_navigation_path() method (see _update_navigation() at the top of the function)

As a workaround I tried this:

if (nav_agent.is_target_reachable()):
    print(nav_agent.get_current_navigation_path())
    print(nav_agent.get_next_path_position())

and it does indeed work, as the path is generated when I call is_target_reachable() and now the full path is printed.

But this is clearly a workaround, and not the intended usage, so my question is, what is the intended way to get the full navigation path between two points on a TileMapLayer? Is the NavigationAgent2D a misuse for this? Should I use something else?