Age, experience, and some suffering can go a long way toward encouraging some humility.
Senna was a jerk at the height of his career, but mellowed as McLaren faltered, he sought refuge at Williams, and repaired his relationship with Prost. Sadly that didn't last very long, and in death, a lot of his earlier behavior was either forgotten by many, or at least seen in a more forgiving light.
Some, of course, like Lauda, is still a grouch, and Foyt would still probably slap you upside the head if did something stupid.
Alonso may have rotten career timing, but he's no fool, and acting like a prima donna would have closed many possible doors to a refuge in IndyCar, or another series. In sports car, where multiple drivers make teamwork even more important, he has fit in as "one of the boys" in his own teammates words.
But, it's also just as likely that the IC paddock, not being full of prima donnas and sharks, is just a more pleasant place to be.