Fixed #22650 -- Fixed regression on prefetch_related.

The original patch for custom prefetching included some defensive logic
to deal with the result of prefetching to a list (i.e. Prefetch(to_attr))
which caused the regression. That logic wasn't actually tested and
shouldn't be needed.

Thanks Aymeric Augustin for the report and tests. Refs #17001.
Fixed the ordering of prefetch lookups so that late lookups can reference
early lookups.

Refs #17001 and #22650.