In Ember 4.12, aborting transition in both from and to route causes infinite loop

This is the code from the Ember guides on aborting a transition in Ember 4.12.

@service router;

  constructor() {

    this.router.on('routeWillChange', (transition) => {
      if (
        ! => === this.routeName) &&
        !confirm('Are you sure you want to abandon progress?')
      ) {

If this same exact code is present in the target route, and I keep clicking cancel in the confirm/cancel dialogue, you get an infinite loop back and forth between the two routes.

For context, all routes in my application extend a parent route, which causes any transition to be aborted if the freezeNav prop is set on the session service. When using willTransition this worked fine, but having refactored to use router.on('routeWillChange... I get this infinite loop issue.

It seems that the router gets confused about the value of this.routeName, always thinking that this is the name of the target route, despite the transition being aborted.

Does anyone have any idea what causes this?