Melee swings are instant. Cast time spells are not.
If I start to cast Moonfire on something that dies, it auto targets the next mob, whether I’m in combat with it or not. Because instant.
But a cast time spell? Eh… that’s getting into some pretty tricky territory there with threat, exploits, etc. Because I’m sure someone will figure out how to exploit that on something.