The anchor node algorithm is written in terms of nodes and elements, but it seems that UAs implement in terms of layout boxes.
This is visible when style changes cause layout boxes to be destroyed and re-created; browsers don't scroll anchor if the anchor's subtree temporarily becomes display: none.
Test case at https://codepen.io/smfr/pen/JoRoKZQ