Problem/Motivation
When loading multiple migrations together, they should be returned in dependency order. For example, with the migrate_example submodule of migrate_plus, the node migration depends on the term and user migrations, and in turn the comment migration depends on the node migration. Enabling only the necessary modules for migrate_example, drush migrate_status loads the migrations and gets them in alphabetical order by ID:
Group: beer Total Imported Unprocessed
beer_comment 5 0 5
beer_node 3 0 3
beer_term 3 0 3
beer_user 4 0 4
If we then do nothing but enable migrate_drupal in addition, we get the desired ordering:
Group: beer Total Imported Unprocessed
beer_term 3 0 3
beer_user 4 0 4
beer_node 3 0 3
beer_comment 5 0 5
This is because migrate_drupal provides a load plugin that does the ordering. Migrate itself should handle the ordering.
Note that the dependency handling in migrate_drupal's load plugin is intertwined with #2507607: Replace Cthulhu-forsaken load plugins/specialized storage handlers with template processors.
Proposed resolution
The straightforward thing to do seems to be decoupling the dependency ordering from the dynamic loading in migrate_drupal and putting it into migrate itself. However, I've started working on the UI for migrate (in the migrate_tools submodule of migrate_plus) and find that even with migrate_drupal enabled, migrations displayed using ConfigEntityListBuilder come out ordered by label. I tracked down this behavior to ConfigEntityBase::sort(), which sorts first by weight and then by label. So, for this use case to work, I believe we'll need to either set weights based on the dependency order, or override sort() to take dependencies into account - hopefully this would address the direct entity_load_multiple() case as well without messing with the load plugin business.
Remaining tasks
Try the weight/sort() approach and see if it works.
User interface changes
N/A
API changes
None
Data model changes
N/A