Possibly relevant:
“Fill Autocomplete From Wikidata api by passing Category”
https://stackoverflow.com/questions/35593986/fill-autocomplete-from-wikidata-api-by-passing-category
Perhaps someone could refactor that to limit results to those in a specific Wikidata query (“countries with an ISO code”, “countries that existed in 1988”, etc.)
I’m obliged to Dan Brickley who recently drew my attention to the linked discussion.