Why not? It seems perfectly intelligible to me which flag means what language.
Yes, it's true that languages tend to be country-specific (e.g. en-US: USA, en-GB: UK, pt-BR for Brazilian Portuguese, etc), but while that's technically true, the majority of Indo-European languages that have spread widely across many nations, don't have enough differences between them to justify using a single specific country flag to represent all of them (namely, en-GB, en-CA, en-AU, and en-US, they're hardly even separate dialects).
In short: Flags identify countries, not languages.
By analogy, it's like using the Java language logo to represent all Java-derived languages (C#, Swift, Golang, Kotlin) because they're mutually-intelligible.
Swift and Go do not belong to that list.