Ghosts are meant to help new players learn about passive invisibility as a mechanic and make "revolver spies" less annoying. They're excluded from stab animations for two reasons:
1) Stab animations are a special case on visibility; the spy is still considered "cloaked" by the code, and they can't shoot their revolver.
2) Ghosts are only balanced because spies can move away from the position where their ghost is seen. A stabbing spy is not mobile. Ghosts can appear for offscreen spies, and therefore you can come on-screen somewhere that you couldn't see the spy, but your client created a ghost. This would show you the exact location of the spy even though you never saw them, and if you're playing e.g. sniper you would be able to shoot them immediately before they move.