### Apache Airflow version

2.5.0

### What happened

We're currently running a suboptimal setup where database connectivity is laggy, 125ms roundtrip.

This has interesting consequences. For example, `airflow roles list` is really slow. Turns out that it's doing a lot of individual queries.

### What you think should happen instead

Ideally, listing roles should be a single (perhaps complex) query.

### How to reproduce

We're using py-spy to sample program execution:

```bash
$ py-spy record -o spy.svg -i --rate 250 --nonblocking airflow roles list
```
Now, to see the bad behavior, the database should incur significant latency.

### Operating System

Linux

### Versions of Apache Airflow Providers

_No response_

### Deployment

Official Apache Airflow Helm Chart

### Deployment details

_No response_

### Anything else

_No response_

### 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)

"""
        Use our url filtering util function so there is consistency between
        FAB and Airflow routes
        """
        from flask_appbuilder.security import views as fab_sec_views
        from airflow.www.views import get_safe_url
        fab_sec_views.get_safe_redirect = get_safe_url
    def post_init(self):
        for baseview in self.baseviews:
            
            self._check_and_init(baseview)
            
            if baseview.__class__.__name__ not in self.get_app.blueprints.keys():
                self.register_blueprint(baseview)
            
        self.add_permissions()
    @property
    def get_app(self):
        """
        Get current or configured flask app
        :return: Flask App
        """
        if self.app:
            return self.app
        else:
            return current_app
    @property
    def get_session(self):