(#18508) Apply resources in the order they are added to the catalog

This implements the bulk of allowing the agent to apply resources in the order
that most users would exect: the order that they are added to the catalog.