An iPhone is just a tiny pocket computer. There is no technical reason preventing an iPhone from running shell scripts and emulators. The only reason why it can't do is because Apple controls what apps you are allowed to run on your phone.
Actually, yes. If the iPhone was an open platform that could open it up for many use cases involving shell scripting and such. As for game emulators I already run several on my Android phone with great luck, so that is indeed a valid use case.