It was probably never planned for him to die, he probably had no choice because as far as the rest of them are concerned he shouldn't have survived Deidara's final blast. There's no way they would have foreseen Deidara fighting Sasuke and blowing himself up.