[Master Balls, I imagine, are something of a hot topic because they can catch any Pokemon- including legendaries. It’s why they’re so rare- not only because an item that powerful is so difficult to manufacture, but because of the moral arguments of a Pokemon captured so forcibly, and potential for misuse.
Pokemon and humans live harmoniously- they give each other assistance and benefits when working together. Often, a wild Pokemon that is caught allows itself to be caught and choses to follow its trainer, once their strength and ability to lead is proven to it in a battle (though the effectiveness of a used pokeball still is a factor).
Legendaries take this to the highest extreme. Often in the games- particularly the box legendaries- they’ll be captured at the peak of the story, where working with the protagonist is necessary to stop a greater evil. At this point, they’ve likely been watching for a while, having seen the hero’s heart for what it is. The battle in which you can catch them, in my mind, serves as a “final trial-” to weaken it before it officially joins your party, having deemed you worthy and aligned with its goal, duty, desires, etc! Effectively, this means the protagonist is something of a chosen one. Fun, huh?
Postgame legendaries and mythicals, I imagine, follow a similar rule- it’s a matter of, you’ve already proven your strength, and they are willing to bow if you seek them out.
However, I do believe most of this is a temporary arrangement. They’ve still got a duty to fufill in most cases, whatever that may be- they’ll follow, obey, and remain allied with a chosen trainer, but I think that often soon after their journey ends, they’ll head their seperate ways and return to the wild. And a good-hearted trainer, like the heroes they would choose, would gladly let them go.
If they don’t, these Gods are more than powerful enough to put them in their place and leave by force.
Anyways this is why you can just casually see box and other regional legendaries in seemingly unrelated games later on. They don’t remain with one trainer forever (they just still really like that One Guy)!]
[As for MissingNo, well. Can’t say much.
But, y'know… All animals have simple goals when it comes down to it.
Survive. Spread. Thrive.]
[… Ace has a lot of theories regarding glitch Pokemon, though. Of course their knowledge is limited, but maybe they’d be good to ask, too!]