Through what right do countries exist and have rights and those rights transfer to their citizens? What causes me to have a right to control the Texas/Mexico border?
A political community can make a claim over a territory because it builds institutions that build and defend it. It's not identical to homesteading, but it's similar. Think of private property and national sovereignty as different layers of ownership that emerge through similar principles.