He was always going to die in Star Wars. Also he was fucking nominated for best supporting actor for that movie. Many people seem to forget that.
Obi-Wan was originally going to survive the Death Star escape and just hang out with Leia and Dodonna and the other rebels on Yavin IV until Lucas realized that having him do that was a waste of the character and that since his role in the movie was over anyway it was better to kill him in accordance with the hero's journey.