This is fallout from changing the tab states.
Use gtk_box_gadget_reverse_children and gtk_css_node_reverse_children to flip the children of the header_gadget and the tabs_gadget when appropriate. Add new CSS node tests to verify that the node order is updated as expected in all cases.