As you hint at as well, iOS 13 changes the default way that view controllers are presented modally. They can now be dismissed by swiping down too. The ModalNavigationRouter doesn’t currently detect when this happens, so it doesn’t call performOnDismissed and nothing is cleaned up!
Fortunately, there’s an easy fix for this, by conforming to UIAdaptivePresentationControllerDelegate:
Make ModalNavigationRouter conform to UIAdaptivePresentationControllerDelegate by adding the following to the end of ModalNavigationRouter.swift: