The only solution I have found is to revert my Discourse installation to the previous version.
This does work for me on every container rebuild attempt:
params: version: e0285bc20ec10e117743e671c45643e63eccfdbc
This fails for me on every container rebuild attempt:
params: version: tests-passed
So I think it is definitely a Discourse bug, and if the new Discourse release exceeds the rubygems.org rate limits, it is Discourse problem, not rubygems.org problem.
A possible solution for Discourse could be to implement some timeouts in gems fetching to be compatible with the rubygems.org rate limits: