Apparently ParserOptions::getUser()->getOption( 'language' ) doesn't provide the right language here, only ParserOptions::getUserLang() does. We use the former as an optimization in Scribunto_LuaWikibaseLibrary::getLanguage and Scribunto_LuaWikibaseEntityLibrary::getLanguage to only split the parser cache when actually needed.
As far as I see, we only call getLanguage when a Lua function is called anyway, so this hack probably doesn't save us much, so I suggest dropping it.