Would it be possible to write an iOS app that could prevent other apps from running on an unjailbroken iphone / ipad?
This would be for legitimate purposes, e.g. I turn the app on, hand my iPad to my child and I don’t have to worry that they’ll delete my photos or browse the web.
No, Not programmatically. You cannot control another app from your app unless the iPhone is jail broken. However you can get a list of processes in iOS as mentioned in this post. You can try to send SIGKILL to terminate them if you are not planning to release this app to appstore(Not recommended).
Regarding the above point, probably the easiest solution is to check Guided Access for this purpose.
Use Guided Access to:
where an accidental gesture might cause a distraction
You can tap Settings > General > Accessibility > Guided Access to set up Guided Access. From there you can:
Start a Guided Access session
Disable app controls and areas of the app screen
Ignore all screen touches
Keep iPhone, iPad, or iPod touch from switching from portrait to landscape or from responding to any other motions
End a Guided Access session
All these details are taken from the above link.