It doesn't ignore HTML structure, it ends up like it does precisely because it iterates through the structure in order when moving the boxes to either side. It makes it fairly predictable if you just loop through the structure in your head and push the boxes to the side they are floated at.
float deliberately takes elements out of content flow ("ignores HTML structure"). That's its entire thing. That's its deal. You don't want that? Don't use float.