### Summary

When calling a handler that is a task that should be run only once, the task is called twice.

### Issue Type

Bug Report

### Component Name

core

### Ansible Version

```console
$ ansible --version

ansible [core 2.14.6]
  config file = /MY_PROJECT/ansible/ansible.cfg
  configured module search path = ['/MY_PROJECT/ansible/library']
  ansible python module location = /home/naja/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/naja/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/naja/.local/bin/ansible
  python version = 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (/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() = /MY_PROJECT/ansible/ansible.cfg
DEFAULT_BECOME_METHOD(/MY_PROJECT/ansible/ansible.cfg) = sudo
DEFAULT_BECOME_USER(/MY_PROJECT/ansible/ansible.cfg) = root
DEFAULT_FILTER_PLUGIN_PATH(/MY_PROJECT/ansible/ansible.cfg) = ['/MY_PROJECT/ans>
DEFAULT_FORKS(/MY_PROJECT/ansible/ansible.cfg) = 10
DEFAULT_GATHERING(/MY_PROJECT/ansible/ansible.cfg) = explicit
DEFAULT_HASH_BEHAVIOUR(/MY_PROJECT/ansible/ansible.cfg) = merge
DEFAULT_HOST_LIST(/MY_PROJECT/ansible/ansible.cfg) = ['/MY_PROJECT/ansible/inve>
DEFAULT_JINJA2_NATIVE(/MY_PROJECT/ansible/ansible.cfg) = True
DEFAULT_LOAD_CALLBACK_PLUGINS(/MY_PROJECT/ansible/ansible.cfg) = True
DEFAULT_LOG_PATH(/MY_PROJECT/ansible/ansible.cfg) = /MY_PROJECT/ansible/logs/an>
DEFAULT_MODULE_PATH(/MY_PROJECT/ansible/ansible.cfg) = ['/MY_PROJECT/ansible/li>
DEFAULT_MODULE_UTILS_PATH(/MY_PROJECT/ansible/ansible.cfg) = ['/MY_PROJECT/ansi>
DEFAULT_ROLES_PATH(/MY_PROJECT/ansible/ansible.cfg) = ['/MY_PROJECT/ansible/rol>
DEFAULT_STDOUT_CALLBACK(/MY_PROJECT/ansible/ansible.cfg) = default.py
DEFAULT_VAULT_IDENTITY_LIST(/MY_PROJECT/ansible/ansible.cfg) = ['dts@vault/keyring-client.py', 'prod@vault/keyring-c>
HOST_KEY_CHECKING(/MY_PROJECT/ansible/ansible.cfg) = False

BECOME:
======

runas:
_____
become_user(/MY_PROJECT/ansible/ansible.cfg) = root

su:
__
become_user(/MY_PROJECT/ansible/ansible.cfg) = root

sudo:
____
become_user(/MY_PROJECT/ansible/ansible.cfg) = root

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

paramiko_ssh:
____________
host_key_checking(/MY_PROJECT/ansible/ansible.cfg) = False

ssh:
___
host_key_checking(/MY_PROJECT/ansible/ansible.cfg) = False
scp_if_ssh(/MY_PROJECT/ansible/ansible.cfg) = True
timeout(/MY_PROJECT/ansible/ansible.cfg) = 60
```


### OS / Environment

Ubuntu 22.04

### Steps to Reproduce

Playbook 1 (pause will be prompted once with flush_handlers, then 2 more times at the end of the play)

```yaml
- hosts: all
  handlers:
    - name: Ping again
      pause:
        prompt: Please ping
  tasks:
    - name: Update something
      notify: Ping again
      changed_when: yes
      ping:

    - name: Flush handlers
      meta: flush_handlers
```

Playbook 2 (ping handler will be executed twice)

```yaml
- hosts: all
  handlers:
    - name: Ping again
      run_once: yes
      ping:
  tasks:
    - name: Update something
      notify: Ping again
      changed_when: yes
      ping:
```

Playbook 3 (ping handler will be executed once with flush_handlers, then 2 more times at the end of the play)

```yaml
- hosts: all
  handlers:
    - name: Ping again
      run_once: yes
      ping:
  tasks:
    - name: Update something
      notify: Ping again
      changed_when: yes
      ping:

    - name: Flush handlers
      meta: flush_handlers
```

### Expected Results

I expect the handler to be run once, no matter the number of hosts

```
PLAY [all] ***********************************************************************************************************************************************

TASK [Update something] **********************************************************************************************************************************
changed: [host4]
changed: [host2]
changed: [host1]
changed: [host3]

TASK [Flush handlers] ************************************************************************************************************************************

TASK [Flush handlers] ************************************************************************************************************************************

TASK [Flush handlers] ************************************************************************************************************************************

TASK [Flush handlers] ************************************************************************************************************************************

RUNNING HANDLER [Ping again] *****************************************************************************************************************************
[Ping again]
Please ping:
^Mok: [hostX]

PLAY RECAP ***********************************************************************************************************************************************
host1                        : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
host2                        : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
host3                        : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
host4                        : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
```

### Actual Results

```console
PLAY [all] ***********************************************************************************************************************************************

TASK [Update something] **********************************************************************************************************************************
changed: [host4]
changed: [host1]
changed: [host2]
changed: [host3]

TASK [Flush handlers] ************************************************************************************************************************************

TASK [Flush handlers] ************************************************************************************************************************************

TASK [Flush handlers] ************************************************************************************************************************************

TASK [Flush handlers] ************************************************************************************************************************************

RUNNING HANDLER [Ping again] *****************************************************************************************************************************
[Ping again]
Please ping:
^Mok: [host2]

RUNNING HANDLER [Ping again] *****************************************************************************************************************************
[Ping again]
Please ping:
^Mok: [host4]

RUNNING HANDLER [Ping again] *****************************************************************************************************************************
[Ping again]
Please ping:
^Mok: [host3]

PLAY RECAP ***********************************************************************************************************************************************
host1                      : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
host2                      : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
host3                      : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
host4                      : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
prompt_continuous = '> '  
    def __init__(self, task, host, task_vars, play_context, result, next_action):
        
        cmd.Cmd.__init__(self)
        self.prompt = '[%s] %s (debug)> ' % (host, task)
        self.intro = None
        self.scope = {}
        self.scope['task'] = task
        self.scope['task_vars'] = task_vars
        self.scope['host'] = host
        self.scope['play_context'] = play_context
        self.scope['result'] = result
        self.next_action = next_action
    def cmdloop(self):
        try:
            cmd.Cmd.cmdloop(self)
        except KeyboardInterrupt:
            pass
    do_h = cmd.Cmd.do_help
    def do_EOF(self, args):
        """Quit"""
        return self.do_quit(args)
    def do_quit(self, args):
        """Quit"""
        display.display('User interrupted execution')
        self.next_action.result = NextAction.EXIT
        return True
    do_q = do_quit
    def do_continue(self, args):