Though you didn't specify, I'm guessing from your link that you're referring to 2D NavMeshes?
2D NavMeshes rely on PolygonCollider2D components, so their shapes can be edited at runtime via script, as you've seen. It wouldn't be trivial, and certainly something that would be specific to your own project given that the map generation would also be so.
Another thread related to this subject can be found here:
Manipulating Unity's own components is outside the scope of this forum, but you can rely on AC's internal hole-generation system once you have the hole shapes to incorporate them into the NavMesh.
AC incorporates holes via separate PolygonCollider2D components that are referenced in the NavMesh Inspector - see the Manual's "Polygon Collider pathfinding". Such components can also be added as holes to the NavMesh through script:
Where "myHole" is a PolygonCollider2D variable. This'll add a hole with that component's shape to the default NavMesh (a NavigationMesh), so if you assign your generated NavMesh into the scene's default you can then amend its holes.
Comments
I'm guessing it's something like this thread (add vertices to a polygon collider):
https://answers.unity.com/questions/624508/how-to-edit-a-polygoncollider2d-vertices-in-code.html
I've never played with it, which is why I ask.
Okay and how to make holes: https://youtu.be/z1r7VjgufJ8