Social etiquette for interacting with PhD peers who complain *a lot*
(as suggested by jabberwocky, I have moved the last part of my answer from here to this question)

Kvetching is a perfectly normal part of mental and social hygiene, but to what extent depends on the person. It is also a self-affirming activity: If complaining leads to positive social experiences (people you talk to relate to your experiences and opinions and share them), you will do this more often. If unchecked, this vicious circle can easily cross your tolerance threshold for complaining (which is different for each person). So, first of all you should keep in mind that "too much complaining" is your subjective view, not an objective truth (absent a concrete case of someone spending the day complaining instead of working and then failing to meet a deadline). Of course, if you'd rather have less complaining around you, it's perfectly legitimate to try to break that circle. 

The best strategy (outside of avoiding complaining peers, which you apparently now follow) is often to lead by example: Do not respond to complaining with your own complaints (especially not with ones about their complaining), but try to steer the conversation to happier grounds by


getting them to relate positive experiences about their PhD;
mentioning ones you might have had (without showing off -- this one can be tricky);
taking an interest in their lives outside of academia.


In short, show them that they can have positive social interactions without complaining. If enough people around you feel the same way as you do, this usually works.

To your final remark: This is by no means limited to PhD students (or even academia) -- you get similar "hot spots" among early-career faculty simultaneously applying for permanent positions (in Europe) or trying to get tenure (in the US), or among tenured faculty of any seniority any time a major evaluation (of a grant or institute) or reaccreditation is imminent.