### Summary

I'm packaging ansible-core for OpenIndiana.  During the construction of 2.15.0 package I noticed the `test_importlib_resources` test fails if there is already ansible/ansible_collections installed.

### Issue Type

Bug Report

### Component Name

test_collection_loader.py

### Ansible Version

```console
2.15.0
```


### Configuration

```console
NA
```


### OS / Environment

OpenIndiana Hipster

### Steps to Reproduce

Run tests in a working directory with `ansible` already installed.

### Expected Results

All tests pass.

### Actual Results

```console
___________________________ test_importlib_resources ___________________________
[gw2] sunos5 -- Python 3.9.16 /usr/bin/python3.9
@pytest.mark.skipif(not PY3, reason='importlib.resources only supported for py3')
    def test_importlib_resources():
        if sys.version_info < (3, 10):
            from importlib_resources import files
        else:
            from importlib.resources import files
        from pathlib import Path

        f = get_default_finder()
        reset_collections_loader_state(f)

        ansible_collections_ns = files('ansible_collections')
        ansible_ns = files('ansible_collections.ansible')
        testns = files('ansible_collections.testns')
        testcoll = files('ansible_collections.testns.testcoll')
        testcoll2 = files('ansible_collections.testns.testcoll2')
        module_utils = files('ansible_collections.testns.testcoll.plugins.module_utils')

        assert isinstance(ansible_collections_ns, _AnsibleNSTraversable)
        assert isinstance(ansible_ns, _AnsibleNSTraversable)
        assert isinstance(testcoll, Path)
        assert isinstance(module_utils, Path)

        assert ansible_collections_ns.is_dir()
        assert ansible_ns.is_dir()
        assert testcoll.is_dir()
        assert module_utils.is_dir()
    
        first_path = Path(default_test_collection_paths[0])
        second_path = Path(default_test_collection_paths[1])
        testns_paths = []
        ansible_ns_paths = []
        for path in default_test_collection_paths[:2]:
            ansible_ns_paths.append(Path(path) / 'ansible_collections' / 'ansible')
            testns_paths.append(Path(path) / 'ansible_collections' / 'testns')

        assert testns._paths == testns_paths
>       assert ansible_ns._paths == ansible_ns_paths
E       AssertionError: assert [PosixPath('/...ons/ansible')] == [PosixPath('/...ons/ansible')]
E         Left contains one more item: PosixPath('/usr/lib/python3.9/vendor-packages/ansible_collections/ansible')
E         Full diff:
E           [
E            PosixPath('$(BUILD_DIR)/test/units/utils/collection_loader/fixtures/collections/ansible_collections/ansible'),
E            PosixPath('$(BUILD_DIR)/test/units/utils/collection_loader/fixtures/collections_masked/ansible_collections/ansible'),
E         +  PosixPath('/usr/lib/python3.9/vendor-packages/ansible_collections/ansible'),
E           ]

test/units/utils/collection_loader/test_collection_loader.py:868: AssertionError
```

The package is being build in a working directory - `$(BUILD_DIR)` - while there is already [ansible_collections](https://pypi.org/project/ansible/) and previous version of `ansible-core` (version 2.14.5) installed in `/usr/lib/python3.9/vendor-packages` via the package manager.
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
assert ansible_collections_ns._paths == [Path(p) / 'ansible_collections' for p in default_test_collection_paths[:2]]
    assert testcoll2 == second_path / 'ansible_collections' / 'testns' / 'testcoll2'
    assert {p.name for p in module_utils.glob('*.py')} == {'__init__.py', 'my_other_util.py', 'my_util.py'}
    nestcoll_mu_init = first_path / 'ansible_collections' / 'testns' / 'testcoll' / 'plugins' / 'module_utils' / '__init__.py'
    assert next(module_utils.glob('__init__.py')) == nestcoll_mu_init
default_test_collection_paths = [
    os.path.join(os.path.dirname(__file__), 'fixtures', 'collections'),
    os.path.join(os.path.dirname(__file__), 'fixtures', 'collections_masked'),
    '/bogus/bogussub'
]
def get_default_finder():
    return _AnsibleCollectionFinder(paths=default_test_collection_paths)
def extend_paths(path_list, suffix):
    suffix = suffix.replace('.', '/')
    return [os.path.join(p, suffix) for p in path_list]
def nuke_module_prefix(prefix):
    for module_to_nuke in [m for m in sys.modules if m.startswith(prefix)]:
        sys.modules.pop(module_to_nuke)
def reset_collections_loader_state(metapath_finder=None):
    _AnsibleCollectionFinder._remove()
    nuke_module_prefix('ansible_collections')
    nuke_module_prefix('ansible.modules')
    nuke_module_prefix('ansible.plugins')
    
    _AnsibleCollectionLoader._redirected_package_map = {}
    AnsibleCollectionConfig._default_collection = None
    AnsibleCollectionConfig._on_collection_load = _EventSource()
    if metapath_finder:
        metapath_finder._install()