I have several examples for consideration.... when Japan annexed Korea when the US bought Alaska when Russia annexed Crimea
What happens to the citizenship of the inhabitants?
I'll fill you in on Alaska's history.
Article III of the Treaty with Russia dated March 30, 1867 states:
The inhabitants of the ceded territory, according to their choice, reserving their natural allegiance, may return to Russia within three years; but if they should prefer to remain in the ceded territory, they, with the exception of uncivilized native tribes, shall be admitted to the enjoyment of all the rights, advantages and immunities of citizens of the United States, and shall be maintained and protected in the free enjoyment of their liberty, property, and religion. The uncivilized tribes will be subject to such laws and regulations as the United States may, from time to time, adopt in regard to aboriginal tribes of that territory.
In short, if you were white, you had rights and if you were Native, you did not.
This was a sharp change for the many thousands of Russianized Natives, called Creoles, who served as the main workforce of the Russian-American Company. Following the Alaska Purchase, most Russians left the territory, though the 1880 U.S. Census identified some Russians near Ninilchik.
Natives remained without citizenship until 1915, when the Alaska territorial legislature came up with a complicated naturalization process that involved declaring a Native was living "separate and apart from any tribe of Indians" and had "adopted the habits of civilized life." These facts had to be supported by at least five white people who had lived in Alaska for at least a year. The candidate was also examined by a panel of teachers.
Enough Natives met this labyrinthine requirement that William Paul was elected to the Alaska Legislature in 1924 as its first Native member. That same year, the U.S. Congress passed the Indian Citizenship Act, which declared, "all non citizen Indians born within the territorial limits of the United States be, and they are hereby, declared to be citizens of the United States ..."
The Short Answer: No. It is not automatic. It depends on what the treaties say.
Longer Answer: It depends on what citizenship means.
In Alaska many inhabitants became subject to the Bureau of Indian Affairs. Did they become real citizens?
When Japan finished it's annexation of Korea, the Koreans became subjects of the Emperor, rather than subjects of the Joseon King. When soverignity changes does citizenship change?