It's just one relatively short period from the mid-19th to mid-20th century where they weren't.
No population is truly homogeneous. The trick is putting together the right social and economic incentives so you can brush over the ethnic differences. To get to a point where people think of ethnic differences as less dividing them into tribes in a battle royale where only one can survive, and more as different opinions on the best flavor of ice cream.
Here is a good video of `Lee Kaun yew` on why single language is important for development of country.
[1]https://www.researchgate.net/publication/314469686_Does_Ethn...
While its title relates to Trump, the video is much moreso about Chinese history and culture and what brought them to the position they're in today.
Read about "The Great Chinese Famine"