Simple
Human nature and basic sociology will play a factor.
Here are some simple possibilities.
1) In any group of people, there are always a small minority that covertly are against the ideology of the rest of the group. It may come in the form of jealousy, envy, revenge, or opposite way of thinking.
I imagine the leaders of the Terminus has pisst someone off in that warehouse who is looking for revenge.
That person or small group of people will help Rick group get out to overthrow the Terminus leaders.
Remember this is kind of the same thing that happen to Governor.
2) The Terminus leaders have some people looking for revenge from the outside. These people already know how the Terminus operates. Will take them down and free the people out of the containers to help overthrow the Terminus. These people could also have Carol and Cutty with them. As they cross paths with these people heading towards the Terminus
you have no clue what's gonna happen