The Israeli prime minister’s career looked finished after the October 7 attack by Hamas. But now he is pursuing a conflict he has proposed for years