### Body

Add unit test for changes in https://github.com/apache/airflow/pull/17305

### Committer

- [X] I acknowledge that I am a maintainer/committer of the Apache Airflow project.
tests/jobs/test_backfill_job.py
@staticmethod
    def clean_db():
        clear_db_dags()
        clear_db_runs()
        clear_db_pools()
    @pytest.fixture(autouse=True)
    def set_instance_attrs(self, dag_bag):
        self.clean_db()
        self.parser = cli_parser.get_parser()
        self.dagbag = dag_bag
    def _get_dummy_dag(
        self,
        dag_maker_fixture,
        dag_id='test_dag',
        pool=Pool.DEFAULT_POOL_NAME,
        max_active_tis_per_dag=None,
        task_id='op',
        **kwargs,
    ):
        with dag_maker_fixture(dag_id=dag_id, schedule_interval='@daily', **kwargs) as dag:
            DummyOperator(task_id=task_id, pool=pool, max_active_tis_per_dag=max_active_tis_per_dag)
        return dag
    def _times_called_with(self, method, class_):
        count = 0
        for args in method.call_args_list:
            if isinstance(args[0][0], class_):
                count += 1
        return count
    def test_unfinished_dag_runs_set_to_failed(self, dag_maker):