### Summary

While specifying requirements.yml to install roles like - 

```
ansible-galaxy role install -r requirements.yml -vvvv
```

With `requirements.yml` (I understand this file syntax is wrong)

```yaml
---
community.vmware
```

results in 
```
ERROR! Unexpected Exception, this is probably a bug: 'str' object has no attribute 'keys'
the full traceback was:

Traceback (most recent call last):
  File "/Volumes/data/src/ansible/lib/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 749, in run
    return context.CLIARGS['func']()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 120, in method_wrapper
    return wrapped_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 1368, in execute_install
    requirements = self._parse_requirements_file(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 840, in _parse_requirements_file
    extra_keys = set(file_requirements.keys()).difference(set(['roles', 'collections']))
                     ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'keys'
```

### Issue Type

Bug Report

### Component Name

ansible-galaxy

### Ansible Version

```console
$ ansible --version
ansible [core 2.17.0.dev0] (i81713 310625996d) last updated 2023/10/04 11:27:33 (GMT -400)
  config file = /Volumes/data/src/playbooks/ansible.cfg
  configured module search path = ['/Users/akasurde/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Volumes/data/src/ansible/lib/ansible
  ansible collection location = /Users/akasurde/.ansible/collections:/usr/share/ansible/collections
  executable location = /Volumes/data/src/ansible/bin/ansible
  python version = 3.11.3 (main, May 10 2023, 12:50:08) [Clang 14.0.3 (clang-1403.0.22.14.1)] (/Users/akasurde/.pyenv/versions/3.11.3/bin/python)
  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
```


### OS / Environment

Red Hat Enterprise Linux release 8.2 (Ootpa)

### Steps to Reproduce

Trying installing role/collection with the above requirements.yml file.


### Expected Results

Installation successful.

### Actual Results

```console
ERROR! Unexpected Exception, this is probably a bug: 'str' object has no attribute 'keys'
the full traceback was:

Traceback (most recent call last):
  File "/Volumes/data/src/ansible/lib/ansible/cli/__init__.py", line 659, in cli_executor
    exit_code = cli.run()
                ^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 749, in run
    return context.CLIARGS['func']()
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 120, in method_wrapper
    return wrapped_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 1368, in execute_install
    requirements = self._parse_requirements_file(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Volumes/data/src/ansible/bin/ansible-galaxy", line 840, in _parse_requirements_file
    extra_keys = set(file_requirements.keys()).difference(set(['roles', 'collections']))
                     ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'keys'
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
ignore_gpg_status_help = 'A space separated list of status codes to ignore during signature verification (for example, NO_PUBKEY FAILURE). ' \
                                 'Descriptions for the choices can be seen at L(https://github.com/gpg/gnupg/blob/master/doc/DETAILS#general-status-codes).' \
                                 'Note: specify these after positional arguments or use -- to separate them.'
        if galaxy_type == 'collection':
            install_parser.add_argument('-p', '--collections-path', dest='collections_path',
                                        default=self._get_default_collection_path(),
                                        help='The path to the directory containing your collections.')
            install_parser.add_argument('-r', '--requirements-file', dest='requirements',
                                        help='A file containing a list of collections to be installed.')
            install_parser.add_argument('--pre', dest='allow_pre_release', action='store_true',
                                        help='Include pre-release versions. Semantic versioning pre-releases are ignored by default')
            install_parser.add_argument('-U', '--upgrade', dest='upgrade', action='store_true', default=False,
                                        help='Upgrade installed collection artifacts. This will also update dependencies unless --no-deps is provided')
            install_parser.add_argument('--keyring', dest='keyring', default=C.GALAXY_GPG_KEYRING,
                                        help='The keyring used during signature verification')  
            install_parser.add_argument('--disable-gpg-verify', dest='disable_gpg_verify', action='store_true',
                                        default=C.GALAXY_DISABLE_GPG_VERIFY,
                                        help='Disable GPG signature verification when installing collections from a Galaxy server')
            install_parser.add_argument('--signature', dest='signatures', action='append',
                                        help='An additional signature source to verify the authenticity of the MANIFEST.json before '
                                             'installing the collection from a Galaxy server. Use in conjunction with a positional '
                                             'collection name (mutually exclusive with --requirements-file).')
            install_parser.add_argument('--required-valid-signature-count', dest='required_valid_signature_count', type=validate_signature_count,
                                        help=valid_signature_count_help, default=C.GALAXY_REQUIRED_VALID_SIGNATURE_COUNT)
            install_parser.add_argument('--ignore-signature-status-code', dest='ignore_gpg_errors', type=str, action='append',
                                        help=opt_help.argparse.SUPPRESS, default=C.GALAXY_IGNORE_INVALID_SIGNATURE_STATUS_CODES,
                                        choices=list(GPG_ERROR_MAP.keys()))
            install_parser.add_argument('--ignore-signature-status-codes', dest='ignore_gpg_errors', type=str, action='extend', nargs='+',
                                        help=ignore_gpg_status_help, default=C.GALAXY_IGNORE_INVALID_SIGNATURE_STATUS_CODES,
                                        choices=list(GPG_ERROR_MAP.keys()))