### Summary

Triggering handlers with `ansible.builtin.meta: flush_handlers` in a role results in an error

### Issue Type

Bug Report

### Component Name

meta

### Ansible Version

```console
$ ansible --version
ansible [core 2.14.0b2]
  config file = /home/twouters/.ansible.cfg
  configured module search path = ['/home/twouters/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/twouters/ansible-2.14/lib/python3.10/site-packages/ansible
  ansible collection location = /home/twouters/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/twouters/ansible-2.14/bin/ansible
  python version = 3.10.7 (main, Sep  6 2022, 21:22:27) [GCC 12.2.0] (/home/twouters/ansible-2.14/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

Arch Linux and Debian but probably irrelevant

### Steps to Reproduce

```
$ tree -Ap                   
[drwx------]  .
├── [drwxr-xr-x]  testrole
│   ├── [drwxr-xr-x]  handlers
│   │   └── [-rw-r--r--]  main.yml
│   └── [drwxr-xr-x]  tasks
│       └── [-rw-r--r--]  main.yml
└── [-rw-r--r--]  test.yml

3 directories, 3 files
```

```
$ cat test.yml 
- hosts: localhost
  pre_tasks:
    - ansible.builtin.command: /bin/true
      notify: do nothing
  handlers:
    - name: do nothing
      ansible.builtin.debug:
        msg: hello
  roles:
    - testrole
```

```
$ cat testrole/tasks/main.yml    
---

- ansible.builtin.command: /bin/true
  notify: noop

- ansible.builtin.meta: flush_handlers

- ansible.builtin.command: /bin/true
```

```
$ cat testrole/handlers/main.yml 
---

- name: noop
  ansible.builtin.debug:
    msg: world
```

### Expected Results

I expect the play to succeed and trigger the handler

```
$ ansible-playbook test.yml -l localhost
[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 [localhost] ***************************************************************************************

TASK [Gathering Facts] *********************************************************************************
ok: [localhost]

TASK [ansible.builtin.command] *************************************************************************
changed: [localhost]

RUNNING HANDLER [do nothing] ***************************************************************************
ok: [localhost] => {
    "msg": "hello"
}

TASK [testrole : ansible.builtin.command] **************************************************************
changed: [localhost]

TASK [testrole : ansible.builtin.meta] *****************************************************************

RUNNING HANDLER [testrole : noop] **********************************************************************
ok: [localhost] => {
    "msg": "world"
}

TASK [testrole : ansible.builtin.command] **************************************************************
changed: [localhost]

PLAY RECAP *********************************************************************************************
localhost                  : ok=6    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
```

### Actual Results

```console
$ ansible-playbook test.yml -l localhost           [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 [localhost] ***************************************************************************************

TASK [Gathering Facts] *********************************************************************************
ok: [localhost]

TASK [ansible.builtin.command] *************************************************************************
changed: [localhost]

RUNNING HANDLER [do nothing] ***************************************************************************
ok: [localhost] => {
    "msg": "hello"
}

TASK [testrole : ansible.builtin.command] **************************************************************
changed: [localhost]

TASK [testrole : ansible.builtin.meta] *****************************************************************
ERROR! BUG: There seems to be a mismatch between tasks in PlayIterator and HostStates.
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
result |= self._tqm.RUN_FAILED_BREAK_PLAY
                display.debug("done checking for any_errors_fatal")
                display.debug("checking for max_fail_percentage")
                if iterator._play.max_fail_percentage is not None and len(results) > 0:
                    percentage = iterator._play.max_fail_percentage / 100.0
                    if (len(self._tqm._failed_hosts) / iterator.batch_size) > percentage:
                        for host in hosts_left:
                            
                            
                            if host.name not in failed_hosts:
                                self._tqm._failed_hosts[host.name] = True
                                iterator.mark_host_failed(host)
                        self._tqm.send_callback('v2_playbook_on_no_hosts_remaining')
                        result |= self._tqm.RUN_FAILED_BREAK_PLAY
                    display.debug('(%s failed / %s total )> %s max fail' % (len(self._tqm._failed_hosts), iterator.batch_size, percentage))
                display.debug("done checking for max_fail_percentage")
                display.debug("checking to see if all hosts have failed and the running result is not ok")
                if result != self._tqm.RUN_OK and len(self._tqm._failed_hosts) >= len(hosts_left):
                    display.debug("^ not ok, so returning result now")
                    self._tqm.send_callback('v2_playbook_on_no_hosts_remaining')
                    return result
                display.debug("done checking to see if all hosts have failed")
            except (IOError, EOFError) as e:
                display.debug("got IOError/EOFError in task loop: %s" % e)
                
                return self._tqm.RUN_UNKNOWN_ERROR
        
        
        return super(StrategyModule, self).run(iterator, play_context, result)