I believe something like the mechanism you are describing has been in production at Google for at least a decade. See this talk [1].
The kernel interface that the article uses (called sched_ext) is the result of the attempts to mainstream the Google thing.