Repository: flutter
Issue: Pop scope not working with the go_router initial routes 
Labels: package,has reproducible steps,P1,p: go_router,team-go_router,triaged-go_router,found in release: 3.24,found in release: 3.26

### Steps to reproduce

create 2 pages with one as initial route .
add PopScope for both pages ,assign canPop as false and use a confirmation dialog ,
for the second page when we use device back gesture it will work as expected ,but for the initial route the app closes without showing any dialog .it even wont reach the onPopInvoked with result .
The issue came to appear after 12 version of go router  

### Expected results

Also show the dialog even if the route is initial one 

### Actual results

The app closes without any dialog 

### Code sample

```
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      routerDelegate: _router.routerDelegate,
      routeInformationParser: _router.routeInformationParser,
    );
  }

  final GoRouter _router = GoRouter(
    initialLocation: '/',
    routes: [
      GoRoute(
        path: '/',
        builder: (context, state) => const FirstPage(),
      ),
      GoRoute(
        path: '/second',
        builder: (context, state) => const SecondPage(),
      ),
    ],
  );
}

class FirstPage extends StatelessWidget {
  const FirstPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return PopScope(
      canPop: false, // Prevents popping
      onPopInvoked: () async {
        final shouldExit = await _showExitDialog(context);
        return shouldExit ?? false;
      },
      child: Scaffold(
        appBar: AppBar(title: const Text('First Page')),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              context.go('/second');
            },
            child: const Text('Go to Second Page'),
          ),
        ),
      ),
    );
  }

  Future<bool?> _showExitDialog(BuildContext context) {
    return showDialog<bool>(
      context: context,
      builder: (context) {
        return AlertDialog(
          title: const Text("Exit Confirmation"),
          content: const Text("Do you really want to exit?"),
          actions: [
            TextButton(
              onPressed: () => Navigator.of(context).pop(false),
              child: const Text("No"),
            ),
            TextButton(
              onPressed: () => Navigator.of(context).pop(true),
              child: const Text("Yes"),
            ),
          ],
        );
      },
    );
  }
}

class SecondPage extends StatelessWidget {
  const SecondPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return opScope(
          canPop:false,
          onPopInvokedWithResult: (bool didPop, Object? object) async {
            if (didPop) {
              return;
            }
        final shouldExit = await _showExitDialog(context);
      if ( shouldExit){
// do stuff like poping screen or some other functions
} 
      },
      child: Scaffold(
        appBar: AppBar(title: const Text('Second Page')),
        body: Center(
          child: ElevatedButton(
            onPressed: () {
              context.go('/');
            },
            child: const Text('Go back to First Page'),
          ),
        ),
      ),
    );
  }

  Future<bool?> _showExitDialog(BuildContext context) {
    return showDialog<bool>(
      context: context,
      builder: (context) {
        return AlertDialog(
          title: const Text("Exit Confirmation"),
          content: const Text("Do you really want to exit?"),
          actions: [
            TextButton(
              onPressed: () => Navigator.of(context).pop(false),
              child: const Text("No"),
            ),
            TextButton(
              onPressed: () => Navigator.of(context).pop(true),
              child: const Text("Yes"),
            ),
          ],
        );
      },
    );
  }
}

```

### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

[Upload media here]

</details>


### Logs

<details open><summary>Logs</summary>

```console
[Paste your logs here]
```

</details>


### Flutter Doctor output

[√] Flutter (Channel stable, 3.24.3, on Microsoft Windows [Version 10.0.22631.4169], locale en-IN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.1)
[√] VS Code (version 1.93.0)
[√] Connected device (4 available)
[√] Network resources