Dahl has a good way of formulating the three classes of goods from 357-8:
1) Goods which are good "in virtue of what is due to those goods themselves, and not for what arises from them together with circumstances that normally accompany them."
2) goods which are good "both in virtue of what is due to those goods themselves and for what arises from them together with circumstances that normally accompany them."
3) goods which are burdensome in themselves but are good for what arises from them together with circumstances that normally accompany them.
That formulation makes it clear that Plato can claim that justice is good for its own sake and for the sake of happiness as long as happiness is internal to the agent. That is because " circumstances that normally accompany them" can be taken to refer to circumstances external to the agent (note that that leaves a gray area insofar as the distinction between agent and circumstances may be unclear).
Plato wants to show that justice belongs to class 2, but to do that, he has to show that justice is worth choosing even if one gets the usual rewards and reputation of INjustice, and even if the unjust person gets the rewards and reputation for justice.
VIRTUE and EUDAEMONIA
(The following are meant to be analytic statements: in other words,
they
explain the contents of the concepts happiness and virtue rather than
offer arguments that should make us accept those concepts)
For Plato, virtue (arete) belongs to a thing that has a characteristic function (ergon): virtue is the quality that makes that thing perform its function well or perhaps the quality of performing that function well. So human virtue makes humans perform characteristically human activity (or activities) well. A 'characteristic activity' is one that a given thing alone does, or that the given thing does better than other things do it.
What that means is that virtue enables a human to live a good life, a life of eudaemonia.
Virtue is supposed to MAKE one act well and BE well off (as Thrasymachus' claim that injustice is a virtue because it makes one well off shows (348-9)).
Plato is 'internalist': full understanding of virtue provides one with a MOTIVE to be virtuous. I.e. if you know what virtue is, you cannot help but want to be virtuous: it has its own motivating force.
So Plato wants to give people a MOTIVE to be just and to claim that just people are BETTER OFF.