How to navigate just one level back in Angular Ionic using default built in mobile back button

I have Ionic Angular with Capacitor.
I am using

  this.router.navigate(['page1'])

to navigate between pages and in template i am using this

routerLink="/intro" routerDirection="forward"

but I have a problem that is, consider i am navigating
page 1 then page 2 then page 3
when i click default mobile back button itgoes like this:
(from page 3) to page 2 to page 1 no matter how many pages in there and that makes a bad UI experience.
How to make pages go back just one page and then back to home page always on the second press of back button.
Now i am using this code:

    App.addListener('backButton', () => {
  const currentUrl = this.router.url;
  if (currentUrl === "/intro") {
      this.withAlert("do you want to exit from app؟", () =>{
      App.exitApp();
}); }  else { this.router.navigate(['/home']); }

but that making it go to Home page from the first back button.