Repository: flutter
Issue: Hero widget stays invisible after page gets popped
Labels: framework,a: animation,f: routes,has reproducible steps,P2,found in release: 3.7,found in release: 3.9,team-framework,triaged-framework

## Steps to Reproduce

Repository with the bug: https://github.com/Tienisto/hero_bug_example

1. Add normal hero animation from page `A` to page `B`
2. `pushAndRemoveUntil` to page `C` with `reverseTransitionDuration: 0`
3. Pop page `C` and get back to `A` (skipping `B` because of `pushAndRemoveUntil`)

**Expected results:** Hero is visible at its start position

**Actual results:** Hero is invisible

<details>
<summary>Code sample</summary>

<!--
      Please create a minimal reproducible sample that shows the problem
      and attach it below between the lines with the backticks.

      To create it you can use `flutter create bug` command and update the `main.dart` file.

      Alternatively, you can use https://dartpad.dev/
      which is capable of creating and running small Flutter apps.

      Without this we will unlikely be able to progress on the issue, and because of that
      we regretfully will have to close it.
-->

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Hero1Page(),
    );
  }
}

class Hero1Page extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          const Text('Hero1Page'),
          Hero(
            tag: 'hero-button',
            child: ElevatedButton(
              onPressed: () {
                Navigator.push(context, MaterialPageRoute(builder: (_) => Hero2Page()));
              },
              child: const Text('Open Hero2Page (This button will stay invisible soon)'),
            ),
          )
        ],
      ),
    );
  }
}

class Hero2Page extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          const Text('Hero2Page'),
          Hero(
            tag: 'hero-button',
            child: ElevatedButton(
              onPressed: () {
                Navigator.pushAndRemoveUntil(context, PageRouteBuilder(
                  pageBuilder: (context, a1, a2) => EndPage(),
                  transitionDuration: Duration.zero,
                  reverseTransitionDuration: Duration.zero,
                ), (r) => r.isFirst);
              },
              child: const Text('Open EndPage'),
            ),
          )
        ],
      ),
    );
  }
}

class EndPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          const Text('EndPage'),
          ElevatedButton(
            onPressed: () => Navigator.pop(context),
            child: const Text('Pop me'),
          ),
        ],
      ),
    );
  }
}
```

</details>

```
[√] Flutter (Channel stable, 3.7.6, on Microsoft Windows [Version 10.0.22621.1265], locale de-DE)
    • Flutter version 3.7.6 on channel stable at C:\Users\tiend\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 12cb4eb7a0 (2 days ago), 2023-03-01 10:29:26 -0800
    • Engine revision ada363ee93
    • Dart version 2.19.3
    • DevTools version 2.20.1
```

</details>