Repository: flutter
Issue: [go_router] Query Parameters are not preserved on `pop`
Labels: package,has reproducible steps,P2,p: go_router,found in release: 3.3,found in release: 3.7,team-go_router,triaged-go_router

## Steps to Reproduce
<details>
<summary>Run the code snippet</summary>

```dart
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

final router = GoRouter(
  routes: [
    ShellRoute(
      builder: (context, state, child) {
        return Scaffold(
          body: child,
          bottomNavigationBar: Text(state.location),
        );
      },
      routes: [
        GoRoute(
          path: '/',
          builder: (context, state) {
            return Page(
              pageNo: 1,
              argument: 'default',
              onTap: () => router.go('/page2?a=apple'),
            );
          },
          routes: [
            GoRoute(
              path: 'page2',
              builder: (context, state) {
                return Page(
                  pageNo: 2,
                  argument: state.queryParams['a'].toString(),
                  onTap: () => router.go('/page2/page3?b=ball'),
                );
              },
              routes: [
                GoRoute(
                  path: 'page3',
                  builder: (context, state) {
                    return Page(
                      pageNo: 3,
                      argument: state.queryParams['b'].toString(),
                    );
                  },
                ),
              ],
            ),
          ],
        ),
      ],
    ),
  ],
);

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      title: 'Go Router Query Demo',
      theme: ThemeData.from(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.red),
      ),
      routerConfig: router,
    );
  }
}

class Page extends StatelessWidget {
  const Page({
    super.key,
    required this.pageNo,
    required this.argument,
    this.onTap,
  });

  final int pageNo;
  final String argument;
  final VoidCallback? onTap;

  @override
  Widget build(BuildContext context) {
    final nextPage = pageNo + 1;

    return Scaffold(
      appBar: AppBar(title: Text('Page $pageNo')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text('Argument: ${argument.toUpperCase()}'),
            const SizedBox(height: 16),
            ElevatedButton(
              onPressed: onTap,
              child: Text('Go to Page $nextPage'),
            ),
            Padding(
              padding: const EdgeInsets.only(top: 16),
              child: ElevatedButton(
                onPressed: pageNo > 1 ? router.pop : null,
                child: const Text('Go back'),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

```

</details>

2. Go to `Page 2` and then `Page 3`
3. Tap on `Go back` once

`Tested with:` **go_router: ^5.2.4** 

**Expected results:**

![image](https://user-images.githubusercontent.com/9782008/206977864-d344af80-2007-4587-8b56-1d86f13f5360.png)


**Actual results:**

![image](https://user-images.githubusercontent.com/9782008/206977883-753f6d3c-9c4a-400a-a586-843414420f1f.png)

<details>
  <summary>flutter doctor -v</summary>

```
[✓] Flutter (Channel stable, 3.3.9, on macOS 13.0.1 22A400 darwin-arm, locale
    en-NP)
    • Flutter version 3.3.9 on channel stable at
      /Users/sarbagya/Development/flutter
    • Upstream repository ssh://git@github.com/flutter/flutter.git
    • FLUTTER_GIT_URL = ssh://git@github.com/flutter/flutter.git
    • Framework revision b8f7f1f986 (3 weeks ago), 2022-11-23 06:43:51 +0900
    • Engine revision 8f2221fbef
    • Dart version 2.18.5
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/sarbagya/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • ANDROID_HOME = /Users/sarbagya/Library/Android/sdk
    • Java binary at: /Users/sarbagya/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335
      /Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14B47b
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /Users/sarbagya/Development/chrome

[✓] Android Studio (version 2021.3)
    • 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
      11.0.13+0-b1751.21-8125866)

[✓] Android Studio (version 2021.3)
    • Android Studio at /Users/sarbagya/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9014738
      /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
      11.0.13+0-b1751.21-8125866)

[✓] Android Studio (version 2021.3)
    • Android Studio at /Users/sarbagya/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/213.7172.25.2113.9123335
      /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
      11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.73.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.42.0

[✓] Connected device (3 available)
    • iPhone 14 Pro Max (mobile) • A4987323-FA06-400E-99D9-4909D34428C8 • ios
      • com.apple.CoreSimulator.SimRuntime.iOS-16-1 (simulator)
    • macOS (desktop)            • macos                                •
      darwin-arm64   • macOS 13.0.1 22A400 darwin-arm
    • Chrome (web)               • chrome                               •
      web-javascript • unknown

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
```

</details>