Repository: flutter
Issue: Nested Navigator Widget rebuild when use pushNamedAndRemoveUntil predicate route false
Labels: framework,f: routes,has reproducible steps,P2,team-framework,triaged-framework,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

1. go to nested navigator Page 1
2. go to nested navigator Page 2
3. pushNamedAndRemoveUntil External navigator (rootNavigator: true,predicate route false) to Page IN. 

nested navigator rebuild page 1 . we can see page 1 before show External Page IN

if remove navigatorKey or Object? routeSettings - all ok (nested navigator do not rebuild)
if predicate return not false, example:  route.isFirst  - all ok 
if declare navigatorKey not in Widget build - all ok

### Expected results

rebuild: nested/page1
rebuild: nested/page2

### Actual results

rebuild: nested/page1
rebuild: nested/page2
rebuild: nested/page1

### Code sample

<details><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(final BuildContext context) {
    return MaterialApp(
      title: 'home',
      initialRoute: '/',
      routes: <String, WidgetBuilder>{
        '/': (final BuildContext context) => const HomeScreen(),
        '/nestedNavigator': (final BuildContext context) => const NestedNavigator(),
        '/in': (final BuildContext context) => const PageIn(),
      },
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(final BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('External Navigator')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextButton(
              child: const Text('Go to Nested Navigator page 1'),
              onPressed: () async {
                await Navigator.pushNamed(context, '/nestedNavigator');
              },
            ),
          ],
        ),
      ),
    );
  }
}

class NestedNavigator extends StatelessWidget {
  const NestedNavigator({super.key});

  @override
  Widget build(final BuildContext context) {
		// remove one
    final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
    final Object? routeSettings = ModalRoute.of(context)?.settings.arguments;

    return Navigator(
      key: navigatorKey,
      initialRoute: 'nested/page1',
      onGenerateRoute: (final RouteSettings settings) {
        late final WidgetBuilder builder;
        print('rebuild: ${settings.name!}');
        switch (settings.name) {
          case 'nested/page1':
            builder = (final BuildContext _) => const NestedPage1();
            break;
          case 'nested/page2':
            builder = (final BuildContext _) => const NestedPage2();
            break;
        }
        return MaterialPageRoute<void>(builder: builder, settings: settings);
      },
    );
  }
}

class PageIn extends StatelessWidget {
  const PageIn({super.key});

  @override
  Widget build(final BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('External Page In')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('This is External Page In'),
            TextButton(
              child: const Text('Go to back start'),
              onPressed: () async {
                await Navigator.of(context).pushNamed('/');
              },
            ),
          ],
        ),
      ),
    );
  }
}

class NestedPage1 extends StatelessWidget {
  const NestedPage1({super.key});

  @override
  Widget build(final BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Nested Navigator page 1')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextButton(
              child: const Text('Go to Nested page 2'),
              onPressed: () async {
                await Navigator.of(context).pushNamed('nested/page2');
              },
            ),
          ],
        ),
      ),
    );
  }
}

class NestedPage2 extends StatelessWidget {
  const NestedPage2({super.key});

  @override
  Widget build(final BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Nested Navigator page 2')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            TextButton(
              child: const Text('Go to External Page In'),
              onPressed: () async {
                await Navigator.of(context, rootNavigator: true).pushNamedAndRemoveUntil(
                  '/in',
                  (final Route route) => false,
                );
              },
            ),
          ],
        ),
      ),
    );
  }
}
```

</details>


### Screenshots or Video

_No response_

### Logs

_No response_

### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
[√] Flutter (Channel stable, 3.13.2, on Microsoft Windows [Version 10.0.19045.3324], locale ru-RU)
    • Flutter version 3.13.2 on channel stable at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ff5b5b5fa6 (8 days ago), 2023-08-24 08:12:28 -0500
    • Engine revision b20183e040
    • Dart version 3.1.0
    • DevTools version 2.25.0

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at G:\DB\soft_db\Android\Sdk\
    • Platform android-33-ext5, build-tools 33.0.2
    • ANDROID_HOME = G:\DB\soft_db\Android\Sdk\
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-10027231)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2022.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.6+0-b2043.56-10027231)

[√] VS Code (version 1.81.1)
    • VS Code at C:\Users\ooovid\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.46.0

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.141
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 116.0.1938.62

[√] Network resources
    • All expected network resources are available.
```

</details>