The AI answer lacks an important nuance
27 years are impressive and more difficult because you are earning loyalty from your own club. Mourinho and Ancelotti were never capable of earning such loyalty from their own clubs, and were kicked out several times.
This is why longevity matters, you proved yourself irreplaceable for so long. Staying is rarely the decision of the coach or the player, it is the decision of the clubs.
It doesn't lack that nuance though, does it? It gave reasons for and against. It stated that it can be spun two ways as most of us would - on one hand, it's neglecting to test in different environments. On the other, it's looking at the same four walls every day, building a legacy at one club and as you said 'earning loyalty from your own club'.
I would suggest that Mourinho and Ancelotti simply have a different personality to Ferguson - Mourinho especially doesn't care if he has to go to other clubs and is more volatile, whereas Ferguson became a cult hero at United by about 1997, so it was very easy for him to 'win loyalty' as they looked at him like a God.
Also, as an aside, khaled where was United's loyalty to Ferguson when he was on the verge of being sacked had he lost the 1990 FA Cup Final? Are you even aware of that? History would have been very different. It's easy to be loyal - both ways - when you dominate domestically, are from the country the club is based in (Britain) and have no desire to move abroad or learn a new language.
If Ferguson had went to Juventus in 1997 or Real Madrid in 2000 - clubs more trigger happy than Man United - then we'd have seen how loyal clubs were to him. He was in an extremely unique position at Man United, and the circumstances and personality are too wildly different to Ancelotti and Mourinho to make a like for like comparison as you are trying to.
'Loyalty' in football is usually just a byproduct of success and convenience, not some inherent moral virtue.