...it all happens when Orange attacks my Castle...
Nevertheless, thank you for pointing it out. It seems that the hex carrying the burden of "open gates" has priority, and this works similarly to the scheme where any other unit occupies a cell with a dead stack - in this case, it cannot be resurrected. This creates another, more well-known bug - a dead stack at the gates prevents them from opening.
The question remains: are these bugs? ))