Repository: flutter
Issue: Quickly popping route sometimes make widget render incorrectly
Labels: framework,f: routes,has reproducible steps,P2,found in release: 2.5,found in release: 2.6,team-framework,triaged-framework

Hello!
I have a problem with the navigator — it animates some transitions incorrectly when the user clicks on the buttons too fast.
I do push, pushReplacement, pop, and expect to get to the start screen and I do but the last transition looks weird.
The same problem appears when I use the pages API of the navigator. 
Is that a bug or do I do something wrong? 
Thanks!

https://user-images.githubusercontent.com/7325744/137792585-649df4d3-4a83-4d36-91bc-0d1306988ff9.mov

```
dima@mbp Repos % flutter doctor -v
[✓] Flutter (Channel stable, 2.5.1, on macOS 11.6 20G165 darwin-x64, locale en-GB)
    • Flutter version 2.5.1 at /usr/local/Caskroom/flutter/2.5.1/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ffb2ecea52 (4 weeks ago), 2021-09-17 15:26:33 -0400
    • Engine revision b3af521a05
    • Dart version 2.14.2
```

```
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return CupertinoApp(
      title: 'Flutter Demo',
      home: Navigator0(),
    );
  }
}

class Navigator0 extends StatelessWidget {
  Widget build(BuildContext context) {
    return Navigator(
      initialRoute: '0',
      onGenerateRoute: (settings) {
        switch (settings.name) {
          case '0':
            return CupertinoPageRoute(
                builder: (_) => Page00(), settings: settings);
          case '1':
            return CupertinoPageRoute(
                builder: (_) => Page01(), settings: settings);
          case '2':
            return CupertinoPageRoute(
                builder: (_) => Page02(), settings: settings);
          default:
            return null;
        }
      },
    );
  }
}

class Page00 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    print('build Page00');
    return Scaffold(
      body: Container(
        color: Colors.red,
        child: GestureDetector(
          behavior: HitTestBehavior.translucent,
          onTap: () {
            Navigator.of(context).pushNamed('1');
          },
          child: Container(),
        ),
      ),
    );
  }
}

class Page01 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    print('build Page01');
    return Scaffold(
      body: Container(
        color: Colors.green,
        child: GestureDetector(
          behavior: HitTestBehavior.translucent,
          onTap: () {
            Navigator.of(context).pushReplacementNamed('2');
          },
          child: Container(),
        ),
      ),
    );
  }
}

class Page02 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    print('build Page02');
    return Scaffold(
      body: Container(
        color: Colors.blue,
        child: GestureDetector(
          behavior: HitTestBehavior.translucent,
          onTap: () {
            Navigator.of(context).pop();
          },
          child: Container(),
        ),
      ),
    );
  }
}
```