Thank you Rob for the mention. I was in a trip so I couldn't reply.
Adding to your excellent suggestions, I would recommend learning the functional programming paradigm from a book like:
Programming in Haskell - 2nd Edition
You can play around with Haskell and keyboard maestro using my plug-in:
Execute a Haskell Script with Arguments - Plug In Actions - Keyboard Maestro Discourse
Haskell helps developing a good and clear mindset about programming in general. In terms of actual use within macOS and iOS apps, JavaScript is a great option. People from Omni have been developing amazing JavaScript API for their products that work both on macOS and iOS. Other apps have taken a similar route.
Rob's functional JS library:
provides a rich set of composable functions.
You would find that you can get really far just by composing with a few functions (and the result would be much more maintainable and clear).