When integrating language-data (https://github.com/wikimedia/language-data), I asked whether there is a recommended way to verify whether a certain language has an existing wikipedia (that is, whether <lang>.wikipedia.org exists). The suggestion was:
Amir Aharoni 25 minutes ago There's no such thing in language-data itself. It tries to be totally independent of Wikipedia. Amir Aharoni 23 minutes ago There are files in the Wikimedia server configuration, which have a list of existing Wikipedias. Amir Aharoni 22 minutes ago I recommend synchronizing with them somehow. The SRE team in technology can probably advise you how to do it. Amir Aharoni 22 minutes ago You can also ask the developers of the mobile apps, because they need something similar. Amir Aharoni 19 minutes ago I do strongly recommend automating it as much as possible, so that you wouldn’t have to add yet another manual step to the Add a wiki procedure (https://wikitech.wikimedia.org/wiki/Add_a_wiki), which is already too long and error-prone.
In the meantime, I've hardcoded the logic to know whether there is a wiki for a certain language using https://meta.wikimedia.org/wiki/List_of_Wikipedias as a source.
This ticket serves as the place for further communication and investigation on automating the process more.