Rambam, Hilchos Teshuvah, 3:1
"Each and every person has merits and sins. A person whose merits exceed his sins is [termed] righteous. A person whose sins exceed his merits is [termed] wicked. If [his sins and merits] are equal, he is termed a Beinoni.
The same applies to an entire country. If the merits of all its inhabitants exceed their sins, it is [termed] righteous. If their sins are greater, it is [termed] wicked. The same applies to the entire world."
An entire generation being called "righteous", does not mean that everything everyone did was always good without sin.
It means that if you add up the whole picture, the generation was completely righteous when looking at the majority of the world's sins and merits at the time.
Also, the learned leaders of a generation (R’ Akiva’s students) may be held to a higher standard than the average person.
But there is a second aspect:
I heard in my Yeshivah, that the Brisker Rav would comment: “If a Rabbi would tell someone that he had a treifah cow and this caused him to lose a large sum of money, the average Jew would accept the Rav’s decision and not eat or sell the cow, assuming a large loss. However, if the same person had a dispute with an opponent in court over a few coins, and the same Rabbi ruled against him, the same simple man would have a yetzer hara to curse the Rabbi and not pay the court’s decision to his friend even though it was a small insignificant sum.”
When it comes to mitzvos between man and Hashem, we all understand. When it comes to mitzvos between man and his fellow, it is too easy for us to never admit we are wrong. It is our nature.
The exile after the 1st Temple was mostly for sins between man and Hashem. It lasted 70 years. The exile for the 2nd Temple was due to causeless hatred between people. Its almost 2000 years later.... we are still working on that.
The lesson is obvious and strong. "Not honoring each other properly" is for some reason easy to fall into, even if you are "righteous".
We would never eat pork. If we did, even by accident, we would throw ourselves on the floor and cry and beg Hashem for forgiveness. We would never say "Who cares, so what, lets move on, big deal, I don't owe Hashem anything etc."
Yet, when we deal with people, we can change our minds, break our word, hurt our feelings, steal, lie, cheat, etc. and when we are faced with it, we can easily say "who cares, so what, move on, I was really right, they are wrong, and immature, etc. I don't owe anything."
The lesson of the students is that even if we are all generally "righteous", we still must examine how we treat people. We need to practice a lot of humility and self-judgment. Did you try to understand the other person? Did you honor them ?
People who think they are wrong will repent; and Hashem would not need to punish them. People who know they are "right" and never wrong... how will they ever repent?
I think the answer is there, even if we are all good people at heart.