As a workaround, collections can be installed from Git instead of Galaxy: Installing collections — Ansible Community Documentation
Same for roles: Galaxy User Guide — Ansible Community Documentation
You’ll need to find out the URL for the collections and roles but that’s how it works.
For example, for the collections included in the Ansible community package you can find the URLs and tags/versions here: ansible-build-data/9/ansible-9.0.0-tags.yaml at main · ansible-community/ansible-build-data · GitHub
Edit: This could be an issue if GitHub goes down as well – which it does, from time to time. However there is nothing preventing you from mirroring the git repos to your local/internal infrastructure and then pulling from there instead.