### 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
"""Double backslashes within jinja2 expressions
    A user may enter something like this in a playbook::
      debug:
        msg: "Test Case 1\\3; {{ test1_name | regex_replace('^(.*)_name$', '\\1')}}"
    The string inside of the {{ gets interpreted multiple times First by yaml.
    Then by python.  And finally by jinja2 as part of it's variable.  Because
    it is processed by both python and jinja2, the backslash escaped
    characters get unescaped twice.  This means that we'd normally have to use
    four backslashes to escape that.  This is painful for playbook authors as
    they have to remember different rules for inside vs outside of a jinja2
    expression (The backslashes outside of the "{{ }}" only get processed by
    yaml and python.  So they only need to be escaped once).  The following
    code fixes this by automatically performing the extra quoting of
    backslashes inside of a jinja2 expression.
    """
    if '\\' in data and '{{' in data:
        new_data = []
        d2 = jinja_env.preprocess(data)
        in_var = False