Necessary? Are you asking whether God had a choice in how He would effect our salvation? Or are you asking whether Christ had to be betrayed in order to be crucified and take the blame for our sins?
The second part of your question. Jesus came to earth to be the Sacrifice that would redeem us from sin and give us life eternal. Was Judas’ betrayal necessary part of that Sacrifice? If Judas had not betrayed Jesus how then would the Sacrifice had come about?