For several years now, we've had this sort of hook-via-code in the Rules engine on our Auth0 identity product. It's been such a powerful enabler for many different integration scenarios that we thought that other companies may find the technology useful for their platforms.
Since committing to building Auth0 Extend, we've seen Twilio launch their functions [2] and just today CloudFlare launched its Workers [3]. It seems like the this is an approach that is in its infancy but that is here to stay!
1: https://auth0.com/extend/developers
2: https://www.twilio.com/docs/api/runtime/functions
3: https://blog.cloudflare.com/introducing-cloudflare-workers/