I'm trying to figure out this aswell. This is an incomplete and probably erroneous answer.
So far I've managed to pathfind using Navigation2DServer but I haven't managed to add dynamic obstacles.
I believe you have to set up Navigation2DServer and then request the path from Navigation2DServer, not to your nav2d instance.
My setup includes calling Navigation2DServer with:
region_set_transform and maybe some others that I'm missing -- in other words you'll be loading a lot of info from your scene onto Navigation2DServer.
After you have set up your map and regions you'd call:
path = Navigation2DServer.map_get_path(map, pos_a, pos_b, true)
You might also want to set up agents and obstacles. I think that agents are used to avoid each other on the fly, while obstacles are 'markers' that somehow work with Navigation2DServer.
Perhaps unrelated: this issue has some images of how it's set up in Godot 4: https://github.com/godotengine/godot/issues/57967
I'm super interested in this, and there is little info on the topic. If you manage to make it work please let me know!