That's a term derived from a Chickens housing. Like other terms, like Flew the coop. We have lots of stuff in our language that's based off of chicken's actually.The phrase 'to be cooped up' refers to being placed inside a small building without freedom to roam outside.
I have always referred to the coop as the building that encloses the birds, with the outdoor area being the run.
Both our pheasants and our poultry have a stall to themselves in our barn, but they used to live in an old shed, which we 'cooped them up' in.
It doesn't really matter as long as your birds can't escape.