Well, it's iterating over a cache, and that's sorted by ID. So that'll be the order it saves metadata.
Keep in mind there are some other things that can cause metadata updates, like new features. For instance, when I added support for sorting by "Recently added", that required a change to all...