There are Chinese-language-only reasons like the many mutually-unintelligible dialects/topolects, the huge difference between spoken and written Chinese languages, but this doesn't explain why subtitling is ubiquitous, even when the entire show is in perfect Mandarin.
This is because subtitles are somewhat required under PRC state authorities, so there are a few other benefits/purposes for subtitling.
- It improves literacy; according to OECD standards of literacy, China has about 80% literacy rate, meaning there are large sections of the populace that are illiterate. SLS (same language subtitling) has been shown to improve literacy, and apart from China this is also done in parts of India for the same reason.
- It makes it easier to understand regional colloquialisms, as the subtitles will replace them with Mandarin versions. For example, the Cantonese "nei hai bin dou", instead of being shown as "你喺邊度", will be subtitled as "你在哪里".
- It is more accessible to deaf viewers. Note that most other countries provide optional closed captions for this purpose.
- It pushes Mandarin/putonghua hegemony, national unity and so on.
This is all enforced by SAPPRFT/SARFT (the equivalent of FCC, but much more powerful) under something called the Language Law. It is constantly evolving, and only really became prominent around the late 90s I believe. This is why if you look at older TV shows, they may not have subtitles. This state organ enforces many other things like requiring Mandarin proficiency for TV presenters, standardised Mandarin terminology, quotas for types of shows deemed less beneficial like reality-TV, historically-inaccurate dramas etc.