### Apache Airflow version

2.2.0b1 (beta snapshot)

### Operating System

Linux

### Versions of Apache Airflow Providers

n/a

### Deployment

Docker-Compose

### Deployment details

Docker Image: apache/airflow:2.2.0b1-python3.8

```shell
$ docker version
Client:
 Version:           20.10.8
 API version:       1.41
 Go version:        go1.16.6
 Git commit:        3967b7d28e
 Built:             Wed Aug  4 10:59:01 2021
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.8
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.6
  Git commit:       75249d88bc
  Built:            Wed Aug  4 10:58:48 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.5.5
  GitCommit:        72cec4be58a9eb6b2910f5d10f1c01ca47d231c0.m
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2d
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
```

```shell
$ docker-compose version
docker-compose version 1.29.2, build unknown
docker-py version: 5.0.2
CPython version: 3.9.6
OpenSSL version: OpenSSL 1.1.1l  24 Aug 2021
```

### What happened

Rendered Template endpoint raise error if not Task Instances exists (e.g. fresh DAG)

```
Traceback (most recent call last):
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/airflow/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/www/auth.py", line 51, in decorated
    return func(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/www/decorators.py", line 72, in wrapper
    return f(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/utils/session.py", line 70, in wrapper
    return func(*args, session=session, **kwargs)
  File "/home/airflow/.local/lib/python3.8/site-packages/airflow/www/views.py", line 1055, in rendered_templates
    ti = dag_run.get_task_instance(task_id=task.task_id, session=session)
AttributeError: 'NoneType' object has no attribute 'get_task_instance'
```

### What you expected to happen

I understand that probably no way to render this value anymore by airflow webserver.

So basically it can be replaced by the same warning/error which throw when we tried to access to XCom for TaskInstance which not exists (Task Instance -> XCom -> redirect to /home -> In top of the page Task Not exists)

![image](https://user-images.githubusercontent.com/85952209/133264002-21c3ff4a-8273-4e24-b00e-cf91639c58b4.png)

However it would be nice if we have same as we have in 2.1 (and probably earlier in 2.x)


### How to reproduce

1. Create new DAG
2. Go to Graph View
3. Try to access Rendered Tab
4. Get an error

![image](https://user-images.githubusercontent.com/85952209/133263628-80e4a7f9-ac82-48d5-9aea-84df1c64a240.png)


### Anything else

Every time.

Sample url: `http://127.0.0.1:8081/rendered-templates?dag_id=sample_dag&task_id=sample_task&execution_date=2021-09-14T10%3A10%3A23.484252%2B00%3A00`

Discuss with @uranusjr 

### Are you willing to submit PR?

- [ ] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)

airflow/www/views.py
"""Show GANTT chart."""
        dag_id = request.args.get('dag_id')
        dag = current_app.dag_bag.get_dag(dag_id)
        dag_model = DagModel.get_dagmodel(dag_id)
        root = request.args.get('root')
        if root:
            dag = dag.partial_subset(task_ids_or_regex=root, include_upstream=True, include_downstream=False)
        wwwutils.check_import_errors(dag.fileloc, session)
        dt_nr_dr_data = get_date_time_num_runs_dag_runs_form_data(request, session, dag)
        dttm = dt_nr_dr_data['dttm']
        form = DateTimeWithNumRunsWithDagRunsForm(data=dt_nr_dr_data)
        form.execution_date.choices = dt_nr_dr_data['dr_choices']
        tis = (
            session.query(TaskInstance)
            .join(TaskInstance.dag_run)
            .filter(
                DagRun.execution_date == dttm,
                TaskInstance.dag_id == dag_id,
                TaskInstance.start_date.isnot(None),
                TaskInstance.state.isnot(None),
            )
            .order_by(TaskInstance.start_date)
        )
        ti_fails = (
            session.query(TaskFail)