How to integrate debugging to a certain app package name so even if it was started from the phone, Android studio catches its breakpoints?

I need to debug an app after switching between several apps on device, But in the new run (make the app alive from the list of last running apps) the process id is changed and the debug is lost.

the problem is the debugger should start exactly when the app starts and debugs processes from "onCreate" .
Using "Attach debugger to Android process" button on Android Studio, takes a time to be manually enabled, and practically is useless because the app has crashed before I can even attach the debugger to the process.

Thanks