ConnectorHierarchyChangeEvent non deterministic nature

I have an issue that happens in my Vaadin-based application, I have a case that requires extracting some components from a layout and adding them into another layout, this works correctly 99.5% but in some rare cases the components will disappear from both the old and new layouts, when this bug happens its persistent across different sessions, UIs, browsers, and browser refreshes; moreover; the bug will disappear only by doing a restart (not a deploy or build … just restart), when I researched this issue, a potential cause can be found in

Please note that hierarchy change events are fired in a non-deterministic order when a message from the server causes multiple parts of the hierarchy to change. This means that the old parent connector might not yet have detached a child widget and that the widget of a removed child might already have been attached by its new parent.

another mention to this is also found in

Hierarchy change events are fired. This means that all state objects and the entire hierarchy are already up to date when this happens. The DOM hierarchy should in theory be up to date after all hierarchy events have been handled, although there are some built-in components that for various reasons do not always live up to this promise.

Have anyone experienced this issue, where components removed from layout and added into another layout will be removed from both, and is this related to the quoted documentation from Vaadin, and how can we prevent this non-deterministic behavior.

My code

if (visibleOperations.contains(entry.getValue().getOperationName())) {
    Component component = entry.getValue().getComponent();
    // this to remove the component form the old Parent
    if (component.getParent() != null) {
        ComponentContainer parent = (ComponentContainer)component.getParent();
    // this to add them to the new layout