Multilingual SVG always unexpectedly use the first 2-letter-match, even the specified language exists
**List of steps to reproduce** (step by step, including full links if applicable):
* Go to https://commons.wikimedia.org/wiki/File:SystemLanguage.svg?lang=ku-latn
* "ku-Latn" is defined after "ku-Arab" in the SVG.
* However, selecting "ku-Latn" return "ku-Arab" as the result of the thumbnail.
* Go to https://commons.wikimedia.org/wiki/File:SystemLanguage.svg?lang=gan
* "gan" is defined after "ga" in the SVG.
* However, selecting "gan" return "ga" as the result of the thumbnail. They are even not identical language code fragments.
**What happens?**:
* Selecting "ku-Latn" return "ku-Arab" as the result of the thumbnail.
* Same issue appeared on "ku", which returned "ku-Arab".
* Same issue appeared on "zh", which returned "ku-Arab".
* Also for other language codes.
* Selecting "gan" return "ga" as the result of the thumbnail, even when they're not identical language code fragments.
* Same issue appeared on "azb", which returned "az".
* Same issue appeared on "ceb", which returned "ce".
* Also for other language codes.
**What should have happened instead?**:
* Selecting "ku-Latn" return "ku-Latn" as the result of the thumbnail.
* Selecting "gan" return "gan" as the result of the thumbnail.
**Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.**:
* Wiki: https://commons.wikimedia.org/wiki/File:SystemLanguage.svg
* Version: 1.39.0-wmf.15 ( 6b53b5d )