I saw it observed recently that Frasier Crane changes as a character between the end of Cheers and the beginning of Frasier. But Frasier in season one is actually pretty similar to his character on Cheers; he changes more in the second and third seasons. That's because past that point we see Frasier happy for the first time. For most of his time on Cheers he's miserable. Remember his comment to Daphne when she was lonely:
"I remember a time back in Boston, I was going through exactly what you're going through now. Just a week later I met a lovely barmaid, sophisticated if a bit loquacious. We fell madly in love and we got engaged... 'course, she left me standing at the altar. But the point is, I didn't give up. I took my poor battered heart and handed it to Lilith... who put it in her little Cuisinart and hit the purée button..."
Frasier left home at 18 for Harvard/Oxford, when Niles was 13. He never really had an adult friendship with his brother until he came back to Seattle. He never had a girlfriend and had few friends, none of which he bothered to keep up with after his return to Seattle at age 40. He never had any sort of relationship with his father either. His mother was the only good relationship he seemed to have, and while clearly loving, she wasn't exactly a warm person.
Frasier presumably spent four years in undergrad, four years in medical school, and four years in residency, making him at least 30 when he finally entered private practice in 1982. He also has a PhD, so research time may have extended that by a bit. When he was done, he decided to stay in the same town his school was in rather than go home. That alone says something.
We never got any hint he had any sort of significant social life or relationships during that twelve year period, beyond a short-lived and ill-considered marriage. Frasier had an affair with his piano teacher just before leaving for Harvard at age 18, then said there was nobody else for six and a half years. He married Nanette during medical school, so presumably she was his next relationship at age 24 or 25. There were a fair number of women in Harvard medical school in the late
seventies, but clearly he had no success connecting with them.
Aside from Nanette, and his Oxford roommate showing up in Frasier season 10, this part of Frasier's life seems to be a complete blank; he never references old friends or relationships. Frasier, to this point, is defined by his academic life and accomplishments.
He was 31 when he met Diane, not long after he finally left school. Diane crushes him, and his mother dies not long after. He stays at Cheers, because he likes having human non-academic connections, of the sort he's never had before, and of the sort he might imagine he could have with his father if they could get over their baggage. Hanging out at Cheers is really the first time Frasier hasn't been buried in psychiatry in his entire life. For a couple years the bar is, from a human standpoint, almost literally all Frasier has.
Then he finds Lilith, a woman who shared a lot of traits with his mother, but who is by most metrics an awful human being. Their marriage slowly falls apart, though it does produce Frederick, who Frasier loves dearly. We also start to see that Frasier has trouble relating to women without it becoming sexual; he tries to sleep with Rebecca, a woman with whom he shares nothing. This is a man who has had almost no good and lasting relationships in his life, of any kind, besides with the barflies at Cheers.
After his second divorce, Frasier gets away from horrible abusive women. He befriends his brother, and finds that he can enjoy elevated conversation in a non-academic setting. He rediscovers their mutual love for opera and theater and fine dining, things he at first rejects, then comes to embrace. He befriends Daphne and Roz, and finds that not all women want to hurt him, and that he can have non-sexual relationships with them. And he overcomes his baggage with his father. This is literally the first time in Frasier's life that he has anything like a normal life.
Frasier changes, because Frasier becomes himself.