### Summary

Ansible is attempting to jinja template the return from a lookup if something in the lookup is a variable itself. But if nothing in the lookup is a template it's fine with not jinja templating the result of the lookup.

Do you have an explanation for the below-described behavior?

### Issue Type

Bug Report

### Component Name

lookup

### Ansible Version

```console
$ ansible --version
ansible [core 2.12.4]
  config file = /home/myuser/.ansible.cfg
  configured module search path = ['/home/myuser/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/devenv-5/lib/python3.9/site-packages/ansible
  ansible collection location = /home/myuser/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/devenv-5/bin/ansible
  python version = 3.9.12 (main, Mar 25 2022, 00:00:00) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)]
  jinja version = 2.11.3
  libyaml = True
```


### Configuration

```console
$ ansible-config dump --only-changed
DEFAULT_LOG_PATH(/home/myuser/.ansible.cfg) = /home/myuser/ansible.log
DEFAULT_STDOUT_CALLBACK(/home/myuser/.ansible.cfg) = yaml
RETRY_FILES_ENABLED(/home/myuser/.ansible.cfg) = False
```


### OS / Environment

Fedora 35

### Steps to Reproduce

 I was able to replicate this with the following playbook:
<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
---
- name: Test some kind of weird lookup thing
  hosts: localhost
  gather_facts: False
  vars:
    file_name: "lookup_test.yml.txt" #"{{ my_file }}"
  tasks:
    - name: Get file content
      set_fact:
        file_content: "{{ lookup('file', file_name) }}"

    - name: Print content
      debug:
        msg: "{{ content }}"
      vars:
        content: "{{ file_content }}"
```

Where lookup_test.yml.txt file was:
```
some_content: "---\nusername: \"{{ foobar }}\""
```

And I get the same results you saw where, if I hard code the file name in the playbook, it works fine:
```
$ ansible-playbook lookup_test.yml -e my_file=lookup_test.yml.txt 
[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 some kind of weird lookup thing] *********************************************************************************************************

TASK [Get file content] *****************************************************************************************************************************
ok: [localhost]

TASK [Print content] ********************************************************************************************************************************
ok: [localhost] => {
    "msg": "some_content: \"---\\nusername: \\\"{{ foobar }}\\\"\""
}

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

But if I remove the hard coded file name and make it a variable by changing the line:
```
file_name: "lookup_test.yml.txt" #"{{ my_file }}"
```
to
```
file_name: "{{ my_file }}"
```

It now fails:
```
$ ansible-playbook lookup_test.yml -e my_file=lookup_test.yml.txt 
[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 some kind of weird lookup thing] *********************************************************************************************************

TASK [Get file content] *****************************************************************************************************************************
ok: [localhost]

TASK [Print content] ********************************************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: {{ file_content }}: some_content: \"---\\nusername: \\\"{{ foobar }}\\\"\": 'foobar' is undefined\n\nThe error appears to be in '/Users/my_user/test/lookup_test.yml': line 12, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Print content\n      ^ here\n"}

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


### Expected Results

The file's content shout be printed as:
```
"some_content: \"---\\nusername: \\\"{{ foobar }}\\\"\""
```

### Actual Results

```console
FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: {{ file_content }}: some_content: \"---\\nusername: \\\"{{ foobar }}\\\"\": 'foobar' is undefined\n\nThe error appears to be in '/Users/my_user/test/lookup_test.yml': line 12, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Print content\n      ^ here\n"}
```
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
raise AnsibleUndefinedVariable(errmsg)
                else:
                    display.debug("failing because of a type error, template data is: %s" % to_text(data))
                    raise AnsibleError("Unexpected templating type error occurred on (%s): %s" % (to_native(data), to_native(te)))
            if isinstance(res, string_types) and preserve_trailing_newlines:
                
                
                
                
                #
                
                
                
                
                
                res_newlines = _count_newlines_from_end(res)
                if data_newlines > res_newlines:
                    res += self.environment.newline_sequence * (data_newlines - res_newlines)
                    if unsafe:
                        res = wrap_var(res)
            return res
        except (UndefinedError, AnsibleUndefinedVariable) as e:
            if fail_on_undefined:
                raise AnsibleUndefinedVariable(e)
            else:
                display.debug("Ignoring undefined failure: %s" % to_text(e))
                return data
    
    _do_template = do_template