To me, the answer to this is quite different from the question of performing for others.
I used to play regularly with a violinist, and before that a cellist. After I moved, I hard a hard time finding musician friends but now I have a cello friend.
To me, playing with someone else has the benefits you mentioned, in terms becoming a better musician through being part of a musical ensemble, the social aspect of sharing music with other, and also the chance to play music that I can't play on my own.
All of these are truly wonderful to experience.
But to my original question: if I'm playing solo music, I don't have to perform it to enjoy it. I can play it on my own, for myself.
The same could be said of an ensemble. You could just play with your friends, or you and your friends could perform for others.
So that's where the question is. Why perform?
🙂