### 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
ManifestKeysType = t.Literal[
        'collection_info', 'file_manifest_file', 'format',
    ]
    FileMetaKeysType = t.Literal[
        'name',
        'ftype',
        'chksum_type',
        'chksum_sha256',
        'format',
    ]
    CollectionInfoKeysType = t.Literal[
        
        'namespace', 'name', 'version',
        'authors', 'readme',
        'tags', 'description',
        'license', 'license_file',
        'dependencies',
        'repository', 'documentation',
        'homepage', 'issues',
        
        FileMetaKeysType,
    ]
    ManifestValueType = t.Dict[CollectionInfoKeysType, t.Union[int, str, t.List[str], t.Dict[str, str], None]]
    CollectionManifestType = t.Dict[ManifestKeysType, ManifestValueType]
    FileManifestEntryType = t.Dict[FileMetaKeysType, t.Union[str, int, None]]
    FilesManifestType = t.Dict[t.Literal['files', 'format'], t.Union[t.List[FileManifestEntryType], int]]
import ansible.constants as C
from ansible.compat.importlib_resources import files
from ansible.errors import AnsibleError
from ansible.galaxy.api import GalaxyAPI