The ordering of certain item tags (sometimes block tag backed) is inconsistent for common groupings like wood types and colored items. The apparent standard for tags is canonical order, based on old meta values, or date added. A vast majority of tags use canonical ordering when applicable (I briefly went through all tags and sorted below, though some may be missed or mislabeled).
At first glance, tag ordering does not matter and is not displayed to players, however, the server sends tags in the order they're parsed, and the recipe book does use tag ordering to cycle through ingredients (for disambiguation, and red "missing" slots), for prioritizing what items to use to fill recipes, and so on. Tag ordering is technically user facing information. I may have missed other situations where this ordering is displayed to players as well, and, in general, as a canonical representation of tags, some care has been taken to make them non-arbitrary for a majority of tags.
Canonical ordering:
Wood:
#minecraft:signs #minecraft:boats #minecraft:wooden_buttons #minecraft:buttons #minecraft:wooden_doors #minecraft:doors #minecraft:wooden_stairs #minecraft:wooden_slabs #minecraft:saplings #minecraft:planks #minecraft:wooden_pressure_plates
Colored:
#minecraft:terracotta #minecraft:candles #minecraft:banners #minecraft:carpets #minecraft:wool
Strange ordering:
Alphabetical:
#minecraft:wooden_trapdoors (subsequently #minecraft:trapdoors)
Red then alphabetical:
#minecraft:beds
Crimson and warped logs swapped:
#minecraft:non_flammable_wood
Only god knows (none have the same ordering):
#minecraft:wooden_fences (subsequently #minecraft:fences)
#minecraft:logs_that_burn (subsequently #minecraft:logs)
#minecraft:leaves
I think the most logical is sorting alphabetically by IDs, with other tags first.