Repository: flutter
Issue: [go_router] Issue with recreating parent route when switches to/from the 1st tab
Labels: package,has reproducible steps,P2,p: go_router,team-go_router,triaged-go_router,found in release: 3.24,found in release: 3.27

### Steps to reproduce

1. Launch the sample
2. Open Flutter Inspector Tree View
3. Click on `Tab page 1` label (it will open another screen)
4. Click on the `SubPage 1` label
5. Everything seems ok. You have the following tree
- TabsPage
- SamplePage
- AnotherTabsPage

<img width="220" alt="Screenshot 2024-11-14 at 20 50 27" src="https://github.com/user-attachments/assets/72f51529-33aa-4d5b-94b8-2965f09d28bf">

7. Click on `Item 1` on the bottom bar (change the index) and you will see that the first screen `TabsPage` disappeared and you have the following stack:
- SamplePage
- AnotherTabsPage

<img width="220" alt="Screenshot 2024-11-14 at 20 50 38" src="https://github.com/user-attachments/assets/a7ef53de-e42f-4517-b269-ee9ee370dd30">

9. Click on `Item 0` and the navigation stack is restored and again you will see:
- TabsPage
- SamplePage
- AnotherTabsPage



### Expected results

The parent screen `SamplePage` should not be rebuilt and `TabsPage` should not disappear depending on the selected tab in the inner navigation bar. 

### Actual results

The parent screen is recreated. The first screen in the stack disappears when you switch to any index except 0. Then it appears again when you go back to 0 index in the inner tab bar.

In my real application it triggers logic in the initState

### Code sample

<details open><summary>Code sample</summary>

I created a sample repository: https://github.com/w3ggy/go_router_issue

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>


https://github.com/user-attachments/assets/537647c4-b84e-4bcf-afab-525167625a49



</details>


### Logs

_No response_

### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0.1 24A348 darwin-arm64, locale
    en-RU)
    • Flutter version 3.24.3 on channel stable at /Users/mac/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (9 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 35.0.0)
    • Android SDK at /Users/mac/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16B40
    • 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.11+0-17.0.11b1207.24-11852314)

[✓] VS Code (version 1.93.1)
    • VS Code at /Applications/Visual Studio Code 2.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (6 available)
    • sdk gphone64 arm64 (mobile)     • emulator-5554                        •
      android-arm64  • Android 15 (API 35) (emulator)
    • iPhone 16 (mobile)              • 2C1D3EBC-5674-437B-8257-0747CC02175C •
      ios            • com.apple.CoreSimulator.SimRuntime.iOS-18-0 (simulator)
    • macOS (desktop)                 • macos                                •
      darwin-arm64   • macOS 15.0.1 24A348 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                •
      darwin         • macOS 15.0.1 24A348 darwin-arm64
    • Chrome (web)                    • chrome                               •
      web-javascript • Google Chrome 130.0.6723.117

[✓] Network resources
    • All expected network resources are available.

• No issues found!
```

</details>