Maurice,
Reassigning boundary IDs (or manifold IDs, material IDs) is somewhat tricky in parallel as they need to stay consistent.
While you would expect the IDs to only matter for locally owned cells, this is not enough because each process needs to know the correct constraints for all "locally active" DoFs. This requires at least the ghost layer to have the correct boundary conditions. Example: a hanging node constraint near a process boundary and the coarse DoFs have boundary values.
There following cases are safe:
1. Create coarse mesh, assign IDs the same way for all cells, then do not change IDs. Any refinement/coarsening will keep IDs updated consistently.
2. Go over all ghost and local cells and reassign IDs after any mesh change (refine/coarsen). This can be a bit tricky to get right in all cases.
Best,
Timo