Well, I think some of them learn to appreciate their captivity. My younger brother (Ross) once had a black rat snake that he raised from a hatching. He carried that snake everywhere and they were nearly inseparable. Every once in a while, Ross would forget to fasten down the cage lid and our mom would find that snake just coiled up on top of the cage. He never wondered far and seemed to be content with the situation.
In another instance, I caught a very large yellow rat snake in the Englewood area (back when it was mostly wild and sparsely populated. I pulled him out of a palm tree in back of the motel my parents had rented for us all. Poor thing was heavily scarred from obvious past battles it had been in. And like the above mentioned black rat snake, occasionally he would find his way out of his cage, but would always be laying right on top of the lid. I think he recognized that the free food comes from above, and he just wanted to be closer to the source.
Heck thinking about it, a long while back I had captured an adult corn snake near the Murdock area of Florida. Again, this was when it was fairly wild and wooly, and the place is wall to wall strip malls and stores now. Anyway, Connie and I were in the area for a while, and this was the first snake I had caught for that trip. So I would take her out of the bag often, to handle her to get her used to it and give her a drink of water. When it came time to leave for home, I had caught other snakes that I wanted to keep more than that original corn snake, so we took her back to where we had captured her. This one was more uniformly orange colored, and I tended to prefer the more Miami Phase looking corns. Matter of fact, this may have been when I caught that original ancestor to the Lavender line, if I am not mistaken. That was right in an abandoned cement "factory" in Murdock, FL, right at the intersection of routes 776 and 41. Anyway, I pulled her out of the bag and laid her on the ground. Normally a snake will just take off away from me, but this girl just kept on turning around, trying to climb up my legs, no matter how many times I would peel her off of my leg and put her back on the ground, she just headed right back to my legs. For all the world seemingly telling me "Please don't send me back into the wild, Mr. Rich!". I had to eventually place her in a tree and then run the other way to the vehicle to escape. Just darn odd behavior. I have never had a snake act like that before nor since. Maybe I should have kept her after all. I kind of feel bad about that, thinking about it.