Repository: flutter
Issue: [go_router] Reset all `StatefulShellBranches` in `StatefulShellRoute` to the initLocation
Labels: package,has reproducible steps,P2,p: go_router,team-go_router,triaged-go_router,found in release: 3.13,found in release: 3.14

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

Here is my route confs:
```dart
final appBranches = [
  StatefulShellBranch(routes: dashboardRoutes),
  StatefulShellBranch(routes: reservationsRoutes),
  StatefulShellBranch(routes: reportsRoutes),
  StatefulShellBranch(routes: shiftsRoutes),
];

final homePageTabRoutes = StatefulShellRoute.indexedStack(
  builder: (_, __, navigationShell) => HomePage(child: navigationShell),
  branches: appBranches,
);

final router = GoRouter(
  debugLogDiagnostics: true,
  navigatorKey: navigatorKey,
  initialLocation: '/${SplashPage.routeName}',
  routes: [
    ...splashRoutes,
    homePageTabRoutes,
    ...accountRoutes,
  ],
);

```

And at some point in my application, I want to reset all my branches to the initial route.
So I tried to do something like getting the navigatorKeys of each branch route and pop from them all 
like the following:

```dart
appBranches.forEach((element) {
        var currentState = element.navigatorKey.currentState;

        if (currentState == null || !currentState.canPop()) return;
        try {
          currentState.pop();
        } catch (e) {
          log(e.toString());
        }
      });
```


**Note.** 
If there are any other ways to implement that please let me know!

### Expected results

To pop from all branches till the initial route without any crash.

### Actual results

but it crashes when I do so, throwing an exception 'index != -1' at 'go_router-10.0.0/lib/src/match.dart' line 265:

```dart
  /// Returns a new instance of RouteMatchList with the input `match` removed
  /// from the current instance.
  RouteMatchList remove(RouteMatch match) {
    final List<RouteMatch> newMatches = matches.toList();
    final int index = newMatches.indexOf(match);
    assert(index != -1); //<= HERE!
    newMatches.removeRange(index, newMatches.length);

```

### Code sample

<details><summary>Code sample</summary>

```dart
final appBranches = [
  StatefulShellBranch(routes: dashboardRoutes),
  StatefulShellBranch(routes: reservationsRoutes),
  StatefulShellBranch(routes: reportsRoutes),
  StatefulShellBranch(routes: shiftsRoutes),
];

final homePageTabRoutes = StatefulShellRoute.indexedStack(
  builder: (_, __, navigationShell) => HomePage(child: navigationShell),
  branches: appBranches,
);

final router = GoRouter(
  debugLogDiagnostics: true,
  navigatorKey: navigatorKey,
  initialLocation: '/${SplashPage.routeName}',
  routes: [
    ...splashRoutes,
    homePageTabRoutes,
    ...accountRoutes,
  ],
);

void popFromAllBranches(){
appBranches.forEach((element) {
        var currentState = element.navigatorKey.currentState;

        if (currentState == null || !currentState.canPop()) return;
        try {
          currentState.pop();
        } catch (e) {
          log(e.toString());
        }
      });
}
```

</details>


### Screenshots or Video

<details>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details><summary>Logs</summary>

```console

[log] 'package:go_router/src/match.dart': Failed assertion: line 265 pos 12: 'index != -1': is not true.
match.dart:265
```

</details>


### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.6, on macOS 13.0.1 22A400 darwin-arm64, locale en-EG)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.81.1)
[✓] Connected device (4 available)
[✓] Network resources

• No issues found!
```

</details>