The lessons that Pip gains through his journey in the novel are necessary for him to have the happiness and wisdom that he eventually achieves in middle age. Upon receiving money, and moving to London, he realizes just how little money means in achieving happiness. He moves to London, becomes a "gentleman," and yet is still unhappy as Estella marries despite his changes, as he is constantly finding himself in debt, and as his past comes back to haunt him later on. The money that he received, when he realizes where it came from, does not seem as glamorous as it used to. He brings his good friend Herbert down in bad spending habits, and is constantly haranged with guilt over his rejection of Joe and Biddy. So, money did not bring him happiness, and being a gentleman did not bring him happiness. He couldn't have learned these lessons any other way, no matter how many people might have told him it.
If he would have stayed at Joe's forge, he would have been constantly discontented, constantly embarrassed by his circumstances, and miserable. He would have longed for a different life, and blamed his circumstances for his misery, instead of his own disposition. His experiences in living a life of "luxury" away from the forge allows him to learn valuable lessons: money isn't happiness; family and friends are all that matter in the world; don't judge a person shallowly; and appreciate the small things in life. He learned those valuable lessons because of his foray into money, and his realization that it wasn't what was important--it was his character, his hard work, and his family. If he had stayed at the forge, he might not have learned those lessons, and instead have been bitter and discouraged his whole life. I hope that helped a bit; good luck!