### Summary

Hi,

Since Ansible 8, when multiple roles include the same dependency and when the first role doesn't run because of a `when` condition, then the dependency is not included at all.

### Issue Type

Bug Report

### Component Name

role

### Ansible Version

```console
ansible [core 2.15.2]
  config file = /home/courgette/Documents/Bimdata/dev/deployment/ansible.cfg
  configured module search path = ['/home/courgette/Documents/Bimdata/dev/deployment/library', '/home/courgette/Documents/Bimdata/dev/deployment/kubespray/library']
  ansible python module location = /home/courgette/.virtualenvs/deploy/lib/python3.11/site-packages/ansible
  ansible collection location = /home/courgette/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/courgette/.virtualenvs/deploy/bin/ansible
  python version = 3.11.3 (main, Jun  5 2023, 09:32:32) [GCC 13.1.1 20230429] (/home/courgette/.virtualenvs/deploy/bin/python)
  jinja version = 3.1.2
  libyaml = True
```


### Configuration

```console
CONFIG_FILE() = /home/courgette/Documents/Bimdata/dev/deployment/ansible.cfg
DEFAULT_FILTER_PLUGIN_PATH(/home/courgette/Documents/Bimdata/dev/deployment/ansible.cfg) = ['/home/courgette/Documents/Bimdata/dev/deployment/ansible_plugins/filter_plugins']
DEFAULT_TIMEOUT(/home/courgette/Documents/Bimdata/dev/deployment/ansible.cfg) = 60
DEFAULT_VAULT_PASSWORD_FILE(/home/courgette/Documents/Bimdata/dev/deployment/ansible.cfg) = /home/courgette/Documents/Bimdata/dev/deployment/.get-vault-pass.sh
EDITOR(env: EDITOR) = vim
PAGER(env: PAGER) = less

CONNECTION:
==========

paramiko_ssh:
____________
timeout(/home/courgette/Documents/Bimdata/dev/deployment/ansible.cfg) = 60

ssh:
___
pipelining(/home/courgette/Documents/Bimdata/dev/deployment/ansible.cfg) = True
timeout(/home/courgette/Documents/Bimdata/dev/deployment/ansible.cfg) = 60
```


### OS / Environment

Archlinux

### Steps to Reproduce

- Create a file `roles/test_a/tasks/main.yml` with:
```
---
- name: "Debug."
  ansible.builtin.debug:
    msg: "test_a"
```
- Create a file `roles/test_b/meta/main.yml` with:
```
 ---
dependencies:
  - role: test_a
 ```

- Create a file `roles/test_b/tasks/main.yml` with:
```
---
- name: "Debug."
  ansible.builtin.debug:
    msg: "test_b
```

- Duplicate test_b into test_c: `cp -r roles/test_b roles/test_c`
- Modify the debug message of the test_c role: `sed -i 's/test_b/test_c/g' roles/test_c/tasks/main.yml`

- Create the file `test.yml` with:
```
---
- name: Test
  hosts: localhost
  gather_facts: false
  become: false
  vars:
    skip_b: true
    skip_c: false
  roles:
    - role: test_b
      when: not skip_b
    - role: test_c
      when: not skip_c
```

- Run : `ansible-playbook test.yml`

### Expected Results

I expected test_a to be include by test_c, but I was chocked that it did not.

It's working fine with Ansible 7. For reference, here the complete version of ansible 7 that I use, and the corresponding output.
```
ansible [core 2.14.8]
  config file = /home/courgette/Documents/Bimdata/dev/deployment/ansible.cfg
  configured module search path = ['/home/courgette/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/courgette/.virtualenvs/deploy/lib/python3.11/site-packages/ansible
  ansible collection location = /home/courgette/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/courgette/.virtualenvs/deploy/bin/ansible
  python version = 3.11.3 (main, Jun  5 2023, 09:32:32) [GCC 13.1.1 20230429] (/home/courgette/.virtualenvs/deploy/bin/python)
  jinja version = 3.1.2
  libyaml = True
```

```
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Test] *********************************************************************************************************************************************************************************************************

TASK [test_a : Debug.] **********************************************************************************************************************************************************************************************
skipping: [localhost]

TASK [test_b : Debug.] **********************************************************************************************************************************************************************************************
skipping: [localhost]

TASK [test_a : Debug.] **********************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "test_a"
}

TASK [test_c : Debug.] **********************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "test_c"
}

PLAY RECAP **********************************************************************************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0   

```

### Actual Results

```console
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'

PLAY [Test] *********************************************************************************************************************************************************************************************************

TASK [test_a : Debug.] **********************************************************************************************************************************************************************************************
skipping: [localhost]

TASK [test_b : Debug.] **********************************************************************************************************************************************************************************************
skipping: [localhost]

TASK [test_c : Debug.] **********************************************************************************************************************************************************************************************
ok: [localhost] => {
    "msg": "test_c"
}

PLAY RECAP **********************************************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
'''
    This is the base class for strategy plugins, which contains some common
    code useful to all strategies like running handlers, cleanup actions, etc.
    '''
    
    
    
    ALLOW_BASE_THROTTLING = True
    def __init__(self, tqm):