Fixed the ordering of prefetch lookups so that late lookups can reference
early lookups.

Thanks Tim Graham for the review. Refs #17001 and #22650.