The difference is when McGregor killed himself to make 145 he could rehydrate, rebound, and deliver a performance at his peak level, while Oliveira couldn't even make 145 half the time, and when he did it probably wasn't the best version of Charles Oliveira.
When moving to 155 McGregor was the biggest name in the sport and the piles of money he brought in made him Dana White's favored son, who got to play by his own set of rules. Oliveira's was given an ultimatum, move to 155 or find employment elsewhere. He returned to lightweight on the boss's shit list, and was booked accordingly.
Inactivity, a belief that a fighting style reliant on power and take down defense that could dominate featherweights would carry over, and outside distractions have left us with a version of Conor McGregor that doesn't belong anywhere near the top 5 of the lightweight division. Oliveira has been focused on fighting. Over time his body physically matured, sanded down the rough edges in his game, and in ring experience has imparted self-confidence and improved his decision making. He has developed into a guy that can make the claim he's the best lightweight in the world, Khabib's retirement status also allows him to make this claim.
Charles is a better fighter today, but both guys have been at the top, and both deserved to be in that position. Like a lot of things in life, timing, priorities, circumstance, and outside distractions have a great effect on how things turn out and how someone arrives where they are at any particular moment. I suspect both guys are happy with their life, and would not want to trade places with the other, so they aren't that different, really.