I would like to write some sort of macro app that presses keys. Would this be possible on IOS and/or Android?
Yes, for android, have you tried MonkeyRunner
The monkeyrunner tool provides an API for writing programs that control an Android device or emulator from outside of Android code. With monkeyrunner, you can write a Python program that installs an Android application or test package, runs it, sends keystrokes to it, takes screenshots of its user interface, and stores screenshots on the workstation.