>>12024213They can leave whenever they want.
I doubt most trainers would stop a pokemon who truly wants to leave.
let's remember these pokemon can kill you very easily. They shoot fire, ice, electricity, cause earthquakes, and can even bend reality in the case of legendaries.
If a Salamence wants to go, it can go any time.
Why doesn't it? Because it doesn't want to.