Optimize available_countries

Use .sort_by so that we only run .parameterize once per country.

Fixes #4889