### Summary

When trying to install multiple collections from local directory using `type: subdirs` in requirements.yml, `ansible-galaxy` throws raw python unhandled exception.

Problem started occur when updated ansible to `8.0.0`. 

### Issue Type

Bug Report

### Component Name

ansible-galaxy

### Ansible Version

```console
$ ansible --version
ansible [core 2.15.0]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/dist-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] (/usr/bin/python3)
  jinja version = 3.1.2
  libyaml = True
```


### Configuration

```console
# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all
CONFIG_FILE() = None
```


### OS / Environment

Ubuntu 22.04, Debian Bullseye 

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```bash (paste below)
ansible-galaxy collection init collections.testa && ansible-galaxy collection init collections.testb \
&& echo """
collections:
  - source: ./collections
    type: subdirs
""" > requirements.yml && ansible-galaxy install -r requirements.yml
```


### Expected Results

Same as in previous versions - installation of all collections inside the directory, using directory name as namespace. 

### Actual Results

```console
ERROR! Unexpected Exception, this is probably a bug: endswith first arg must be str or a tuple of str, not bytes
to see the full traceback, use -vvv
```

```pytb
Traceback (most recent call last):
  File ".../ansible/lib/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File ".../ansible/bin/ansible-galaxy", line 715, in run
    return context.CLIARGS['func']()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../ansible/bin/ansible-galaxy", line 117, in method_wrapper
    return wrapped_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../ansible/bin/ansible-galaxy", line 1369, in execute_install
    self._execute_install_collection(
  File ".../ansible/bin/ansible-galaxy", line 1409, in _execute_install_collection
    install_collections(
  File ".../ansible/lib/ansible/galaxy/collection/__init__.py", line 681, in install_collections
    unsatisfied_requirements = set(
                               ^^^^
  File ".../ansible/lib/ansible/galaxy/collection/__init__.py", line 684, in <genexpr>
    Requirement.from_dir_path(sub_coll, artifacts_manager)
  File ".../ansible/lib/ansible/galaxy/dependency_resolution/dataclasses.py", line 221, in from_dir_path
    if dir_path.endswith(to_bytes(os.path.sep)):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: endswith first arg must be str or a tuple of str, not bytes
```

### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
:param ignore_signature_errors: GPG errors to ignore during signature verification
    """
    try:
        with tarfile.open(b_coll_targz_path, mode='r') as collection_tar:
            
            _extract_tar_file(collection_tar, MANIFEST_FILENAME, b_collection_path, b_temp_path)
            if keyring is not None:
                manifest_file = os.path.join(to_text(b_collection_path, errors='surrogate_or_strict'), MANIFEST_FILENAME)
                verify_artifact_manifest(manifest_file, signatures, keyring, required_signature_count, ignore_signature_errors)
            files_member_obj = collection_tar.getmember('FILES.json')
            with _tarfile_extract(collection_tar, files_member_obj) as (dummy, files_obj):
                files = json.loads(to_text(files_obj.read(), errors='surrogate_or_strict'))
            _extract_tar_file(collection_tar, 'FILES.json', b_collection_path, b_temp_path)
            for file_info in files['files']:
                file_name = file_info['name']
                if file_name == '.':
                    continue
                if file_info['ftype'] == 'file':
                    _extract_tar_file(collection_tar, file_name, b_collection_path, b_temp_path,
                                      expected_hash=file_info['chksum_sha256'])
                else:
                    _extract_tar_dir(collection_tar, file_name, b_collection_path)
    except Exception:
        
        shutil.rmtree(b_collection_path)
        b_namespace_path = os.path.dirname(b_collection_path)
        if not os.listdir(b_namespace_path):
            os.rmdir(b_namespace_path)
        raise
def install_src(collection, b_collection_path, b_collection_output_path, artifacts_manager):