### Apache Airflow version

Other Airflow 2 version (please specify below)

### What happened

ON Airflow 2.4.2 Dag dependencies graph show deleted DAGs that use to have dependencies to currently existing DAGs

### What you think should happen instead

Deleted DAGs should not appear on DAG Dependencies

### How to reproduce

Create a DAG with dependencies on other DAG, like a wait sensor.
Remove new DAG

### Operating System

apache/airflow:2.4.2-python3.10

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

db.clear_db_serialized_dags()
        with mock.patch("airflow.models.serialized_dag.COMPRESS_SERIALIZED_DAGS", request.param):
            yield
        db.clear_db_serialized_dags()
    def test_dag_fileloc_hash(self):
        """Verifies the correctness of hashing file path."""
        assert DagCode.dag_fileloc_hash("/airflow/dags/test_dag.py") == 33826252060516589
    def _write_example_dags(self):
        example_dags = make_example_dags(example_dags_module)
        for dag in example_dags.values():
            SDM.write_dag(dag)
        return example_dags
    def test_write_dag(self):
        """DAGs can be written into database"""
        example_dags = self._write_example_dags()
        with create_session() as session:
            for dag in example_dags.values():
                assert SDM.has_dag(dag.dag_id)
                result = session.query(SDM).filter(SDM.dag_id == dag.dag_id).one()
                assert result.fileloc == dag.fileloc
                
                SerializedDAG.validate_schema(result.data)
    def test_serialized_dag_is_updated_if_dag_is_changed(self):