There are times where you don’t want iOS to act like Android and this is one of them. On Android, it’s somewhat acceptable for the back button to eventually lead back to the main menu and then if pressed again, exit (or ask the user if they intended to exit before actually exiting). On iOS, this is forbidden behavior. iOS doesn’t have a back button. Apps, per Apple’s design guidelines, should never exit intentionally.
If you want your app to behave as they should, you’re going to have them behave differently in this case.
Rob