If Sonny gets arrested for beating Carlo to death,that means the tollbooth hit never went down.So even if Sonny would have beat the rap,he still would be in jail,if only for a few days. Plenty of time for him to be "shot trying to escape", or to "hang himself in his jail cell".Barzini could still get to Sonny,and all the more so because at that point Vito didn't know that it was Barzini all along.
Of course Sonny could have made bail and still caught a couple hundred rounds at a later date.