Repository: flutter
Issue: UIKitView native views are not correctly being deallocated if the widget being removed is behind an opaque route
Labels: platform-ios,engine,a: platform-views,has reproducible steps,P2,found in release: 2.10,found in release: 2.11,team-ios,triaged-ios

<!-- Thank you for using Flutter!

     If you are looking for support, please check out our documentation
     or consider asking a question on Stack Overflow:
      * https://flutter.dev/
      * https://api.flutter.dev/
      * https://stackoverflow.com/questions/tagged/flutter?sort=frequent

     If you have found a bug or if our documentation doesn't have an answer
     to what you're looking for, then fill out the template below. Please read
     our guide to filing a bug first: https://flutter.dev/docs/resources/bug-reports
-->

## Steps to Reproduce

1. In a widget structure like this:
NavigatorA -> [ RouteA1, RouteA2 -> NavigatorB -> [ RouteB1(containing UiKitView), RouteB2(opaque) ]]

2. if the subsequent widget structure is the following:
NavigatorA -> [RouteA1]
(basically entirely removing the Route that contains a nested navigator that contains a UIKitView widget that is currently hidden behind an opaque view)...

3. ...Then the iOS native side never receives the deinit call inside its UIView (because the UIView is never deallocated)

If RouteB2 is not opaque, then the iOS native side correctly receives the native deinit call and the UIView is correctly deallocated.

(The UIView is also correctly deallocated after a hot restart, giving us a hint about the fact that the flutter engine is still somewhat keeping a reference to it when it is about to perform a deep cleanup prior to a restart).

I'm sorry, but I don't have time right now to create a reproducible sample, but I was hoping that whoever created or contributed to create the code related to platform native views might have a clue about what could be causing this issue, and eventually solve it.
I'm quite sure this is due to some performances optimizations that are done in the Render Objects when they are placed behind other opaque views, that are making so that some steps are skipped when they are removed from the render tree.

<details>
<!-- Finally, paste the output of running `flutter doctor -v` here. -->

```
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.0.1 21A559 darwin-arm, locale it)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2021.2.3)
[✓] VS Code (version 1.63.2)
[✓] Connected device (2 available)

! Doctor found issues in 1 category.
```

</details>


<!--
      Consider also attaching screenshots and/or videos to better
      illustrate the issue.

      You can upload them directly on GitHub.
      Beware that video file size is limited to 10MB.
-->