Borders and migration aren't about a single trait like language, there are many countries worldwide where either the only or primary language is the same, but they're distinctly different countries when it comes to most anything else. Culture and identity are much wider concepts than simply the ability to speak.
There are also many countries where the primary language is the same only because of concerted efforts by the central government to force it upon everyone and to wipe out regional languages and dialects, usually in the past couple centuries or so. France, Spain, Italy are all examples.