The purpose of this action is to interrupt the ongoing cast which will be interrupted anyway due to the target being already dead.
Without it, your character is not ready to attack the next enemy until the game client cancels the cast automatically. Depending on circumstances, it may take up to 4 seconds of casting a spell on a dead enemy.
Please note that this behavior is relevant for casters only.
If you experience it with melee or physical ranged jobs, this is a bug which must be investigated separately.