Listing `ansible.legacy` before this change would search the legacy paths twice - once for ansible.legacy, and again for ansible.builtin. This caused issues for differentiating between `ansible.builtin` and `ansible.legacy` (which is probably partly why the `do_replace_legacy` logic existed). So I separated the search paths per loop - now each collection searches only its own paths for plugins.