Is it correct that the concept of nationality has been embodied in China's ancient books?

Of course it is correct.

A nation refers to a stable identity with the same language, region, economic life, culture and psychological quality. Examining this concept, the record of "stable isomorphism" is "Huangdi vs Chiyou" in ancient China. Huangdi, the ancestor of Han nationality, represents a kind of "stable isomorphism", and Chiyou, the ancestor of Miao nationality, is said to represent another kind of "stable isomorphism". Moreover, this legend has been recorded in many ancient books, and the legend itself has been produced even before the emergence of a mature writing system. Simply put, it is older than the history recorded by civilization.