A built-in scripting language. The TI-83 line of calculators have an app programming language that requires you to side-load code from another computer, but they also have TI-BASIC, which allows you to write a wide variety of scripts right on the calculator itself. This should be standard on all 'smart' devices. It's so stupid to have gigahertz of computing power in your pocket and not be able to do anything without writing the app on another machine.
I know Termux for Android exists and that's a good start, but I'd like to see something baked right into the OS that has access to all my device's cool sensors and gizmos. The camera, the microphone, the aux port, the usb port, the accelerometer, the bluetooth antenna... all of those things should be exposed to the user. This would be a really good use case for 'visual' programming ala Scratch, since you could assemble a script right from a touch screen instead of having to plug in a keyboard.
Try Kustom Widget (KWGT). It's a scripted mini app maker that exposes a lot of the phone internals, and it keeps expanding. The developer is really responsive to feature requests. I use it with my home weather station and a pi-based sensor network to monitor home security. When I get my solar installed, I'll add in the status of that system. The major limitation is that KWGT is event driven, with a minimum update interval of once a second. This interval has a major impact on battery life, so the default is one minute.