I know it's quite old one, but you should be able to achieve this with NavMesh Surface:
https://docs.unity3d.com/Manual/class-NavMeshSurface.html
It's official created by Unity, but it's not part of Unity though as of now - check that link for how to install it.
NavMesh Surface can be prefabed along with NavMesh itself and connected such e.g. planes are automatically connected together, so you should be able to instantiate such prefab with script as needed, while keeping NavMesh functionality and to add another benefit of this - it actually can be in 2D game as well (e.g. top-down shooter) since there is no angle restriction for baking.