### 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
dag = dag.partial_subset(task_ids_or_regex=root, include_downstream=False, include_upstream=True)
        num_runs = request.args.get('num_runs', type=int)
        if num_runs is None:
            num_runs = conf.getint('webserver', 'default_dag_run_display_number')
        try:
            base_date = timezone.parse(request.args["base_date"])
        except (KeyError, ValueError):
            base_date = dag.get_latest_execution_date() or timezone.utcnow()
        with create_session() as session:
            dag_runs = (
                session.query(DagRun)
                .filter(DagRun.dag_id == dag.dag_id, DagRun.execution_date <= base_date)
                .order_by(DagRun.execution_date.desc())
                .limit(num_runs)
                .all()
            )
            dag_runs = {dr.execution_date: alchemy_to_dict(dr) for dr in dag_runs}
            tree_data = self._get_tree_data(dag_runs, dag, base_date, session=session)
        
        return htmlsafe_json_dumps(tree_data, separators=(',', ':'))
    @expose('/robots.txt')
    @action_logging
    def robots(self):
        """
        Returns a robots.txt file for blocking certain search engine crawlers. This mitigates some
        of the risk associated with exposing Airflow to the public internet, however it does not
        address the real security risks associated with such a deployment.
        """
        return send_from_directory(current_app.static_folder, 'robots.txt')
class ConfigurationView(AirflowBaseView):