### Apache Airflow version

2.7.1

### What happened

Unable to retrieve logs for task inside task group inside mapped task group.
Got `404 "TaskInstance not found"` in network requests

### What you think should happen instead

_No response_

### How to reproduce

```
from datetime import datetime
from airflow import DAG
from airflow.decorators import task, task_group
from airflow.operators.bash import BashOperator
from airflow.utils.task_group import TaskGroup

with DAG("mapped_task_group_bug", schedule=None, start_date=datetime(1970, 1, 1)):
    @task
    def foo():
        return ["a", "b", "c"]


    @task_group
    def bar(x):
        with TaskGroup("baz"):
            # If child task group exists, logs 404
            #  "TaskInstance not found"
            # http://localhost:8080/api/v1/dags/mapped_task_group_bug/dagRuns/manual__2023-09-21T22:31:56.863704+00:00/taskInstances/bar.baz.bop/logs/2?full_content=false
            # if it is removed, logs appear
            BashOperator(task_id="bop", bash_command="echo hi $x", env={"x": x})


    bar.partial().expand(x=foo())
```

### Operating System

debian 11 / `astro dev start`

### Versions of Apache Airflow Providers

_No response_

### Deployment

Astronomer

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

return redirect(self.get_default_url())
def action_has_dag_edit_access(action_func: Callable) -> Callable:
    """Decorator for actions which verifies you have DAG edit access on the given tis/drs."""
    @wraps(action_func)
    def check_dag_edit_acl_for_actions(
        self,
        items: list[TaskInstance] | list[DagRun] | TaskInstance | DagRun | None,
        *args,
        **kwargs,
    ) -> Callable:
        if items is None:
            dag_ids: set[str] = set()
        elif isinstance(items, list):
            dag_ids = {item.dag_id for item in items if item is not None}
        elif isinstance(items, (TaskInstance, DagRun)):
            dag_ids = {items.dag_id}
        else:
            raise ValueError(
                "Was expecting the first argument of the action to be of type "
                "list[TaskInstance] | list[DagRun] | TaskInstance | DagRun | None."
                f"Was of type: {type(items)}"
            )
        for dag_id in dag_ids:
            if not get_airflow_app().appbuilder.sm.can_edit_dag(dag_id):
                flash(f"Access denied for dag_id {dag_id}", "danger")
                logging.warning("User %s tried to modify %s without having access.", g.user.username, dag_id)
                return redirect(self.get_default_url())
        return action_func(self, items, *args, **kwargs)
    return check_dag_edit_acl_for_actions
class SlaMissModelView(AirflowModelView):