### Summary

Running a playbook :https://dpaste.org/WJEwm#L98 against a Windows 10 target, the first When: block is ignored correctly, the first task in the second When: block errors out with:

```
task path: /etc/ansible/devel/sysops/code/ansible/Update-splunkuf-spl.yml:54
The full traceback is:
Traceback (most recent call last):
  File "/home/svc-ansiblemgmt/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 158, in run
    res = self._execute()
  File "/home/svc-ansiblemgmt/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 556, in _execute
    plugin_vars = self._set_connection_options(cvars, templar)
  File "/home/svc-ansiblemgmt/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 1038, in _set_connection_options
    if k.startswith('ansible_%s_' % self._connection._load_name) and k not in options:
AttributeError: 'int' object has no attribute 'startswith'
fatal: [windows-host1]: FAILED! => {
    "msg": "Unexpected failure during module execution: 'int' object has no attribute 'startswith'",
    "stdout": ""
}
```

As per #mackerman & #bcoca the offending line is 33

          when: 200.stat.exists == false

Having an integer where a string should be

### Issue Type

Bug Report

### Component Name

register

### Ansible Version

```console
$ ansible --version
ansible [core 2.14.1]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/svc-ansiblemgmt/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/svc-ansiblemgmt/.local/lib/python3.9/site-packages/ansible
  ansible collection location = /home/svc-ansiblemgmt/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/svc-ansiblemgmt/.local/bin/ansible
  python version = 3.9.5 (default, Nov 23 2021, 15:27:38) [GCC 9.3.0] (/usr/bin/python)
  jinja version = 3.1.2
  libyaml = False
```


### 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
ANSIBLE_COW_SELECTION(/etc/ansible/ansible.cfg) = default
CONFIG_FILE() = /etc/ansible/ansible.cfg
DEFAULT_CALLBACK_PLUGIN_PATH(/etc/ansible/ansible.cfg) = ['/usr/share/ansible/plugins/callback']
DEFAULT_HOST_LIST(/etc/ansible/ansible.cfg) = ['/etc/ansible/inventory']
GALAXY_SERVER_LIST(/etc/ansible/ansible.cfg) = ['aaphub_linux']
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
INVENTORY_IGNORE_EXTS(/etc/ansible/ansible.cfg) = ['~', '.orig', '.bak', '.ini', '.cfg', '.retry', '.pyc', '.pyo']

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

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

ssh:
___
host_key_checking(/etc/ansible/ansible.cfg) = False
```


### OS / Environment

Ubuntu 20.04.5

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
- name: Update SplunkUF SPL file
  become: yes 
  become_method: runas
  hosts: "{{ targets }}"
  tasks:
    - when: '"Linux" in ansible_system'
      block:
        - name: Check to see if Splunk path exists
          stat:
            path: /opt/splunkforwarder/
          register: splunk
​
        - name: If splunk does not exist skip host
          meta: end_host
          when: splunk.stat.exists == false
​
        - name: Get SPL file, copy to Splunks working directory
          copy:
            src: /etc/ansible/playbooks/files/splunk/splunkclouduf.spl
            dest: /root/installed/splunkclouduf.spl
            owner: root
            group: root
​
        - name: Extract and set ownership of SPL file to 100
          shell: |
            tar -zxvf /root/installed/splunkclouduf.spl -C /opt/splunkforwarder/etc/apps/
            chown -r root:root /opt/splunkforwarder/etc/apps/100_splunkcloud
          debugger: on_failed
​
        - name: Does target have a 200_splunkcloud directory?
          stat:  
            path: /opt/splunkforwarder/etc/apps/200_splunkcloud/
          register: 200
​
        - name: Extract and set ownership of SPL file to 200
          shell: |
            tar -zxvf /root/installed/splunkclouduf.spl -C /opt/splunkforwarder/etc/apps/
            chown -r root:root /opt/splunkforwarder/etc/apps/200_splunkcloud
          debugger: on_failed
          when: 200.stat.exists == false
​
        - name: Restart splunk daemon 
          shell: /opt/splunkforwarder/bin/splunk restart
          register: service_status
          async: 10
        - debug: msg="{{ service_status.stdout }}"
​
    - when: '"Win32NT" in ansible_system'
      block:
        - name: Check for existing SplunkForwarder service before proceeding
          win_service:
            name: SplunkForwarder
          register: win_splunk
​
        - name: fail when service exists
          meta: end_host
          when: service_info.exists == true
​
        - name: Create destination directory if not exit
          win_file:
            path: C:\it_temp
            state: directory
          when: win_splunk.stat.isdir is defined and win_splunk.stat.isdir
​
        - name: Copy Jamf splunk app directory to 100 app
          win_copy:
            src: /etc/ansible/playbooks/files/splunk/100_splunkcloud/
            dest: 'C:\Program Files\SplunkUniversalForwarder\etc\apps'
​
        - name: Does target have a 200_splunkcloud directory?
          win_stat:  
            path: 'C:\Program Files\SplunkUniversalForwarder\etc\apps\200_splunkcloud\'
          register: win_200
​
        - name: Copy splunk app directory to 200 app
          win_copy:
            src: 'C:\Program Files\SplunkUniversalForwarder\etc\apps\100_splunkcloud\'
            dest: 'C:\Program Files\SplunkUniversalForwarder\etc\apps\200_splunkcloud\'
            remote_src: yes
          debugger: on_failed
          when: win_200.stat.exists == true
​
        - name: Restart Splunk
          win_command:
            cmd: '"C:\Program Files\SplunkUniversalForwarder\bin\splunk.exe" "restart"'
```


### Expected Results

Playbook processes each when: block according to OS facts correctly

### Actual Results

```console
task path: /etc/ansible/devel/sysops/code/ansible/Update-splunkuf-spl.yml:54
The full traceback is:
Traceback (most recent call last):
  File "/home/svc-ansiblemgmt/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 158, in run
    res = self._execute()
  File "/home/svc-ansiblemgmt/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 556, in _execute
    plugin_vars = self._set_connection_options(cvars, templar)
  File "/home/svc-ansiblemgmt/.local/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 1038, in _set_connection_options
    if k.startswith('ansible_%s_' % self._connection._load_name) and k not in options:
AttributeError: 'int' object has no attribute 'startswith'
fatal: [windows-host1]: FAILED! => {
    "msg": "Unexpected failure during module execution: 'int' object has no attribute 'startswith'",
    "stdout": ""
}
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
"""Continue to next result"""
        self.next_action.result = NextAction.CONTINUE
        return True
    do_c = do_continue
    def do_redo(self, args):
        """Schedule task for re-execution. The re-execution may not be the next result"""
        self.next_action.result = NextAction.REDO
        return True
    do_r = do_redo
    def do_update_task(self, args):
        """Recreate the task from ``task._ds``, and template with updated ``task_vars``"""
        templar = Templar(None, variables=self.scope['task_vars'])
        task = self.scope['task']
        task = task.load_data(task._ds)
        task.post_validate(templar)
        self.scope['task'] = task
    do_u = do_update_task
    def evaluate(self, args):
        try:
            return eval(args, globals(), self.scope)
        except Exception:
            t, v = sys.exc_info()[:2]
            if isinstance(t, str):
                exc_type_name = t
            else:
                exc_type_name = t.__name__
            display.display('***%s:%s' % (exc_type_name, repr(v)))
            raise
    def do_pprint(self, args):