Issue type:
Bug

Airflow version:
2.0.1 (although bug may have existed earlier, and master still has the bug)

Issue:
The scheduler sometimes queues tasks in alphabetical order instead of in priority weight and execution date order. This causes priorities to not work at all, and causes some tasks with name later in the alphabet to never run as long as new tasks with names earlier in the alphabet are ready.

Where the issue is in code (I think):
The scheduler will query the DB to get a set of task instances that are ready to run: https://github.com/apache/airflow/blob/2.0.1/airflow/jobs/scheduler_job.py#L915-L924
And will simply get the first `max_tis` task instances from the result (with the `limit` call in the last line of the query), where `max_tis` is computed earlier in the code as cumulative pools slots available. The code in master improved the query to filter out tasks from starved pools, but still it will get the first `max_tis` tasks only with no ordering or reasoning on which `max_tis` to take.
Later, the scheduler is smart and will queue tasks based on priority and execution order:
https://github.com/apache/airflow/blob/2.0.1/airflow/jobs/scheduler_job.py#L978-L980
However, the correct sorting (second code link here) will only happen on the subset picked by the query (first code link here), but the query will not pick tasks following correct sorting.
This causes tasks with lower priority and / or later execution date to be queued BEFORE tasks with higher priority and / or earlier execution date, just because the first are higher in alphabet than the second, and therefore the first are returned by the unsorted limited SQL query only.

Proposed fix:
Add a "sort by" in the query that gets the tasks to examine (first code link here), so that tasks are sorted by priority weight and execution time (meaning, same logic as the list sorting done later). I am willing to submit a PR if at least I get some feedback on the proposed fix here.
tests/jobs/test_scheduler_job.py
self.clean_db()
        
        
        self.null_exec = MockExecutor()
        self.scheduler_job = None
    def tearDown(self) -> None:
        if self.scheduler_job and self.scheduler_job.processor_agent:
            self.scheduler_job.processor_agent.end()
            self.scheduler_job = None
        self.clean_db()
    def create_test_dag(self, start_date=DEFAULT_DATE, end_date=DEFAULT_DATE + timedelta(hours=1), **kwargs):
        dag = DAG(
            dag_id='test_scheduler_reschedule',
            start_date=start_date,
            
            end_date=end_date,
        )
        dag.clear()
        dag.is_subdag = False
        with create_session() as session:
            orm_dag = DagModel(dag_id=dag.dag_id, is_paused=False)
            session.merge(orm_dag)
            session.commit()
        return dag
    @classmethod
    def setUpClass(cls):