### 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
roles_path.add_argument('-p', '--roles-path', dest='roles_path', type=opt_help.unfrack_path(pathsep=True),
                                default=C.DEFAULT_ROLES_PATH, action=opt_help.PrependListAction,
                                help='The path to the directory containing your roles. The default is the first '
                                     'writable one configured via DEFAULT_ROLES_PATH: %s ' % default_roles_path)
        collections_path = opt_help.ArgumentParser(add_help=False)
        collections_path.add_argument('-p', '--collections-path', dest='collections_path', type=opt_help.unfrack_path(pathsep=True),
                                      action=opt_help.PrependListAction,
                                      help="One or more directories to search for collections in addition "
                                      "to the default COLLECTIONS_PATHS. Separate multiple paths "
                                      "with '{0}'.".format(os.path.pathsep))
        cache_options = opt_help.ArgumentParser(add_help=False)
        cache_options.add_argument('--clear-response-cache', dest='clear_response_cache', action='store_true',
                                   default=False, help='Clear the existing server response cache.')
        cache_options.add_argument('--no-cache', dest='no_cache', action='store_true', default=False,
                                   help='Do not use the server response cache.')
        
        type_parser = self.parser.add_subparsers(metavar='TYPE', dest='type')
        type_parser.required = True
        
        collection = type_parser.add_parser('collection', help='Manage an Ansible Galaxy collection.')
        collection.set_defaults(func=self.execute_collection)  
        collection_parser = collection.add_subparsers(metavar='COLLECTION_ACTION', dest='action')
        collection_parser.required = True
        self.add_download_options(collection_parser, parents=[common, cache_options])
        self.add_init_options(collection_parser, parents=[common, force])
        self.add_build_options(collection_parser, parents=[common, force])
        self.add_publish_options(collection_parser, parents=[common])
        self.add_install_options(collection_parser, parents=[common, force, cache_options])
        self.add_list_options(collection_parser, parents=[common, collections_path])
        self.add_verify_options(collection_parser, parents=[common, collections_path])