Google and Apple need to fix this by not allowing apps to start up by themselves, by not letting them run in the background without permission, and giving user control for killing apps.
Even so, being able to disable background processes still would be helpful, possibly to save power and/or RAM.
What else would be needed is possibility to provide fake data (for location, sensors, contacts, etc), including fake error codes (which is also possible to test program working in case of errors).