Despite appearances the “Han Chinese” don’t really conform to the stereotype of an ethnic group. The fact that they speak diverse local languages is just one aspect of this.
South-central China can be divided into a number of regional systems, each typically centered around the drainage basin of a major river, that do not correspond to administrative divisions. G. William Skinner pioneered the study of these macroregions, although we should note that he was primarily interested in economic and social relations, not linguistic ones.
In the introduction to an innovative study of the history of Hakka migration and ethnicity in the Lingnan region by Sow-Theng Leong, Skinner notes that speech group boundaries and regional ones line up:
For the most part, each of the major speech groups of southeastern China dominated one macroregional or subregional core. In the Lower Yangzi, it was Wu speakers of the Taihu subgroup. In the Ou-Ling subregion of the Southeast Coast macroregion, it was Wu speakers of the Oujiang subgroup. The core areas of the other three subregions of the Southeast Coast were each dominated by a distinct Min-speaking group: Hokchius in the Min basin, Hokkiens in the Zhang-Quan subregion, and Teochius in the Hanjiang basin. For the rest, Cantonese dominated the regional core of Lingnan, Gan speakers that of the Gan Yangzi, and Xiang speakers that of the Xiang basin subregion of the Middle Yangzi. Of all the major cultural/linguistic groups of South-Central China, only the Hakkas had no substantial drainage basin of their own. (p.3)
The Hakkas were the exception because their heartland was actually a mountainous area peripheral to several river systems. In the early Qing period, they migrated in large numbers to several different areas that were expanding economically, but by the 19th century changed economic conditions and overpopulation led to conflict between immigrant Hakkas and the core speech group (Cantonese in the Lingnan region, for example.) This conflict took on an ethnic character, so we could actually say that the speech groups within what is now called “the Han Chinese” behaved like ethnic groups in some ways. Yet according to Leong, there wasn’t much in the way of pan-Hakka solidarity across regions, even when the Hakkas in, say, Lingnan banded together for self-defense in the face of Cantonese discrimination.
So generally, linguistic/ethnic divisions within the “Han Chinese” can be explained by looking at regional systems within China.
Reference: Sow-Theng Leong, Migration and Ethnicity in Chinese History: Hakkas, Pengmin and their Neighbors (Stanford UP 1997)