Repository: flutter
Issue: Null check exception - pop on ShellRoute that was pushed by a StatefulShellRoute
Labels: c: regression,package,a: error message,has reproducible steps,P1,p: go_router,team-go_router,triaged-go_router,found in release: 3.24,found in release: 3.26

### What package does this bug report belong to?

go_router

### What target platforms are you seeing this bug on?

iOS

### Have you already upgraded your packages?

Yes

### Dependency versions

<details><summary>pubspec.lock</summary>

```lock
https://pastebin.com/xDKJyK9q

```

</details>


### Steps to reproduce

1. Have the first page with a StatefulShellRoute
2. Have the second page with a ShellRoute
3. Make push from the first page to the second
4. Make pop from second page

### Expected results

Return to first page

### Actual results

Null check exception

### Code sample

### The code is messy because I used dartpad with example codes from GoRouter itself

<details open><summary>Code sample</summary>

```dart
https://pastebin.com/UUCQSYWT
```

</details>


### Screenshots or Videos

<details open>
<summary>Screenshots / Video demonstration</summary>

![image](https://github.com/user-attachments/assets/9fbd0240-6609-417e-8ad2-06004ad40b08)

</details>


### Logs

_No response_

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0 24A335 darwin-arm64, locale pt-BR)
    • Flutter version 3.24.3 on channel stable at /Users/danielmessias/fvm/versions/3.24.3
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (2 weeks ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/danielmessias/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/danielmessias/Library/Android/sdk
    • ANDROID_SDK_ROOT = /Users/danielmessias/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11609105)

[✓] VS Code (version 1.93.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.96.0

[✓] Connected device (5 available)
    • iPhone de Danael (mobile)           • 00008101-0012781C3EE2001E            • ios            • iOS 18.0 22A3354
    • iPhone SE (3rd generation) (mobile) • 15C04484-8302-46BF-B695-832D37822F15 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                     • macos                                • darwin-arm64   • macOS 15.0 24A335 darwin-arm64
    • Mac Designed for iPad (desktop)     • mac-designed-for-ipad                • darwin         • macOS 15.0 24A335 darwin-arm64
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 129.0.6668.70

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>