### Summary

trying to list tags from a playbook with --list-tags option show empty lists for "all" TAGS nor for "task" TAGS



### Issue Type

Bug Report

### Component Name

ansible-playbook

### Ansible Version

```console
$ ansible --version
ansible [core 2.14.3]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/stannum/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /home/stannum/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201] (/usr/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
CONFIG_FILE() = /etc/ansible/ansible.cfg
```


### OS / Environment

Arch Linux

### Steps to Reproduce


<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)

ansible-playbook -i inventory.yaml test.yaml --list-tags

yaml file below:
---
- hosts: all

  tasks:

    - name: Configuring iscsi directory structure
      tags:
        - never
        - raidix_host
      when: inventory_hostname in groups['closed_circuit_kvm_hosts'] and item.state == 'directory'
      become: yes
      ansible.builtin.file:
        path: /etc/iscsi/nodes/{{ item.path }}
        state: directory
        owner: root
        group: root
        mode: u=rw,g=,o=
      with_community.general.filetree: files/etc/iscsi/nodes/
      notify:
        - restart iscsi service

    - name: Configuring iscsi service
      tags:
        - never
        - raidix_host
      when: inventory_hostname in groups['closed_circuit_kvm_hosts'] and item.state == 'file'
      become: yes
      ansible.builtin.copy:
        src: '{{ item.src }}'
        dest: /etc/iscsi/nodes/{{ item.path }}
        owner: root
        group: root
        mode: u=rw,g=,o=
      with_community.general.filetree: files/etc/iscsi/nodes/
      notify:
        - restart iscsi service

  handlers:
    - name: Restarting multipathd
      become: yes
      ansible.builtin.service:
        name: multipathd
        enabled: yes
        state: restarted
      listen: restart multipath service

    - name: Restarting iscsi service
      become: yes
      ansible.builtin.service:
        name: iscsi
        enabled: yes
        state: restarted
      notify: restart multipath service
      listen: restart iscsi service


```


### Expected Results

Expecting to see list of tags in square braces
```
ansible-playbook -i inventory.yaml test.yaml --list-tags

playbook: test.yaml

  play #1 (all): all    TAGS: ["never", "raidix_host"]
      TASK TAGS: ["never", "raidix_host"]
```

### Actual Results

```console
$ ansible-playbook -i inventory.yaml test.yaml --list-tags

playbook: test.yaml

  play #1 (all): all    TAGS: []
      TASK TAGS: []
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
taskmsg = ''
                            for task in b.block:
                                if isinstance(task, Block):
                                    taskmsg += _process_block(task)
                                else:
                                    if task.action in C._ACTION_META and task.implicit:
                                        continue
                                    all_tags.update(task.tags)
                                    if context.CLIARGS['listtasks']:
                                        cur_tags = list(mytags.union(set(task.tags)))
                                        cur_tags.sort()