Is there a way of programmatically setting an app so that it lets you automatically reject all phone calls while in the app?
Thankfully this is not supported in any way. A 3rd party app has no control at a all over how a phone call is handled.
This might be possible on a jailbroken device using private APIs, but certainly not for an App Store app running on normal devices.