### 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
"""Create dagruns and ensure only ones with correct states are reset."""
        prefix = 'backfill_job_test_test_reset_orphaned_tasks'
        states = [State.QUEUED, State.SCHEDULED, State.NONE, State.RUNNING, State.SUCCESS]
        states_to_reset = [State.QUEUED, State.SCHEDULED, State.NONE]
        tasks = []
        with dag_maker(dag_id=prefix) as dag:
            for i in range(len(states)):
                task_id = f"{prefix}_task_{i}"
                task = DummyOperator(task_id=task_id)
                tasks.append(task)
        session = settings.Session()
        job = BackfillJob(dag=dag)
        
        dr1 = dag_maker.create_dagrun()
        dr2 = dag.create_dagrun(run_id='test2', state=State.SUCCESS)
        
        dr1_tis = []
        dr2_tis = []
        for i, (task, state) in enumerate(zip(tasks, states)):
            ti1 = TI(task, dr1.execution_date)