How does Phineas growth from a "a careless essence of peace" to a unhappy realist show friendship? When Gene found himself through friendship.
If I understand your question correctly, the supposition is that Gene somehow "found himself" through his friendship with Finny, and you're wondering how Finny's transformation from a rather careless, peaceful fellow to "an unhappy realist" shows friendship. My answer is twofold: One, Gene's "finding himself" is probably due to more than just that friendship. Most things are complicated, and both a life-changing event such as the one with Finny or a national crisis such as the war could have contributed to what happened to Gene. Two, I don't think that transformation in thinking or outlook, in Phineas or anyone else, necessarily demonstrates or shows friendship.
If you're asking if Finny's friendship with Gene causes this shift in thinking and personality, I'd readily answer yes, in part, at least. What is certainly true is that the change happens. So is it all attributable to his relationship with Gene? Not necessarily, though it's certainly a major contributing factor. When one has believed something to be true (in this case, that Gene was Finny's true friend) then finds out an awful truth (in this case, that Gene actually hated Finny enough at one time to try to kill him), there is a natural hurt and bitterness which will inevitably happen. One other contributing factor, though, is the looming presence of the war. We know it has the power to change people from being positive, optimistic, and productive into being isolated, negative, and mean. Think Brinker. And we know Finny grew more disillusioned and bitter about the war; how much of that was due to his injury we'll never know. The reasonable assumption, then, is that probably both of these things caused or contributed to Finny's change in outlook.