I don’t think there’s any way around it. Last I knew, the only way to resurrect and retire is via a direct PUT request (i.e. not the API).
I think the best I could do, if I had time, would be to add a loop to retry until the rate limit releases. The Open Framework already does that for API requests, but since retire/resurrect doesn’t use the API, the script isn’t using the Open Framework.