### Summary

I'm rendering template with special header to change the variable/block start/end string:

```txt
#jinja2:variable_start_string:'<<' , variable_end_string:'>>', block_start_string:'<%', block_end_string:'%>'
```

When rendering this template, some host variables aren't rendered correctly, because the escape sequence override also applies to how these variables are parsed.

### Issue Type

Bug Report

### Component Name

template

### Ansible Version

```console
$ ansible --version
ansible [core 2.11.1] 
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/toolset/lib/python3.8/site-packages/ansible  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/toolset/bin/ansible
  python version = 3.8.10 (default, May 12 2021, 15:56:47) [GCC 8.3.0]
  jinja version = 3.0.1
  libyaml = True
```


### Configuration

```console
$ ansible-config dump --only-changed
ANSIBLE_FORCE_COLOR(env: ANSIBLE_FORCE_COLOR) = True
```


### OS / Environment

For this I'm using `quay.io/ansible/toolset` docker image. (running in CI) but I was able to reproduce it on Ubuntu the same way.

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
#playbook.yml
---
- name: Reproduce issue
  hosts: localhost
  vars:
    var_a: "value"
    var_b: "{{ var_a }}"
    var_c: "<< var_a >>"
  gather_facts: false
  tasks:
    - set_fact:
        var_d: "{{ var_a }}"
    - template:
        dest: ./rendered.txt
        src: ./template.j2
```
Template:
```txt
#jinja2:variable_start_string:'<<' , variable_end_string:'>>', block_start_string:'<%', block_end_string:'%>'
Here should be var_a: << var_a >>
Here should be var_b: << var_b >>
Here should be var_c: << var_c >>
Here should be var_d: << var_d >>
```

### Expected Results

```console
❯ cat rendered.txt
Here should be var_a: value
Here should be var_b: value
Here should be var_c: << var_a >>
Here should be var_d: value
```

### Actual Results

```console
❯ cat rendered.txt
Here should be var_a: value
Here should be var_b: {{ var_a }}
Here should be var_c: value
Here should be var_d: value
```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct
try:
                t = myenv.from_string(data)
            except TemplateSyntaxError as e:
                raise AnsibleError("template error while templating string: %s. String: %s" % (to_native(e), to_native(data)))
            except Exception as e:
                if 'recursion' in to_native(e):
                    raise AnsibleError("recursive loop detected in template string: %s" % to_native(data))
                else:
                    return data
            if disable_lookups:
                t.globals['query'] = t.globals['q'] = t.globals['lookup'] = self._fail_lookup
            jvars = AnsibleJ2Vars(self, t.globals)
            self.cur_context = new_context = t.new_context(jvars, shared=True)
            rf = t.root_render_func(new_context)
            try:
                if self.jinja2_native:
                    res = ansible_native_concat(rf)
                else:
                    res = j2_concat(rf)
                unsafe = getattr(new_context, 'unsafe', False)
                if unsafe:
                    res = wrap_var(res)
            except TypeError as te:
                if 'AnsibleUndefined' in to_native(te):
                    errmsg = "Unable to look up a name or access an attribute in template string (%s).\n" % to_native(data)
                    errmsg += "Make sure your variable name does not contain invalid characters like '-': %s" % to_native(te)
                    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)))