Just to elaborate a bit, the trick is based on using the MediaWiki builtin parser function {{int:...}} that fetches a system message (essentially a page in the MediaWiki: namespace, though some of them are predefined). The function takes the user lannguage in account in case it's different than the content language, so if for example the user has chosen their interface langauge to be hebrew, the parser function would look for the page with the suffix /he. If we populate subpages of the system message lang with their own respective langauge code (putting "he" on MediaWiki:Lang/he and so on) we can effectively make {{int:lang}} to return the user langauge, and we can use that via Lua as well.
This alsk isn't exactly about the uselang URL parameter, but about the user's chosen interface language, which one of the ways to choose or override is the URL parameter.
Edit: I also believe that these MediaWiki: namespace pages aren't whitelisted on Fandom for local admins to edit, so it would require a special request from support.