Are there digital cameras (mirrorless or DSLR) that allow the user to write their own applications for the camera? Is this even planned? I know that Sony offers proprietary applications for purchase and that Samsung is switching to Android OS for their cameras, but that's not what I'm looking for.
Dedicated Firmware hacks that replace or run on top of a camera's firmware? Yes.
There is MagicLantern for Canon SLRs and there is CHDK for that runs on Canon compacts.
Basically, the question is whether the camera manufacturer offers an SDK (Canon does, Magic Lantern uses it) and whether the manufacturer condones/accepts such behaviour. If there is an SDK available you can assume someone will have written some mods for the camera if the user base is large enough.
There will however never be any cross-manufacturer modifications, because every camera manufacturer uses its own OS (firmware) with its own API.
Sony now has a REST API for its mirrorless cameras. Looks like something I was looking for! https://developer.sony.com/downloads/camera-file/sony-camera-remote-api-beta-sdk/