Interestingly, Bull snakes developed an immunity to Rattlesnake venom. Evolutionary pressures would be the most likely reason for that immunity. Where did that pressure come from?
This article in the Smithsonian Magazine notes that some animals, including snakes, are immune to some snake venoms, and seems to suggest that the eating of the venomous snakes by the snakes that developed immunity to the venom of the eaten snake may be the cause.
Besides mammals and lizards, there are plenty of snakes that are
immune to snake venom. In some cases, it may be that immunity prevents
the serpents from inadvertently committing suicide when they miss a
mouse and hit themselves instead. (You know what it’s like to bite
your cheek while you’re eating? Now imagine you’re venomous.) But in
other cases, immunity points towards ophiophagy, or snake-eating.
This cause is not clear, because this Wikipedia article suggests otherwise.
Many ophiophagous animals seem to be immune to the venom of the usual
snakes they prey and feed upon. The phenomenon was studied in the
mussurana by the Brazilian scientist Vital Brazil. They have
antihemorrhagic and antineurotoxic antibodies in their blood. The
Virginia opossum (Didelphis virginiana) has been found to have the
most resistance towards snake venom. This immunity is not acquired and
has probably evolved as an adaptation to predation by venomous snakes
in their habitat.[4]
Bull Snakes are thought by some to eat rattlesnakes, but the accepted answer, above, found only very weak evidence of this. Possibly their mere presence in the environment can be sensed by Rattlers and likely creates evasion behavior. Certainly, the immunity had to be created by very close contact with Rattlers which in turn gives evolutionary pressure.