Yeah sure this has been done at a library level before (or highly specialized languages), but in my mind it seems AD at the compiler level would be valuable. I sometimes find myself wishing I could just tell the compiler "take this loss function expressed in pure Kotlin and derive it with respect to x". For long nasty summations especially this would be nice.
Admittedly I need to explore this more though, and you might be right. I don't know what the implications would be in terms of scope and implementation.