Why muteHttpExceptions changes everything
By default, UrlFetchApp throws a JavaScript exception on any 4xx or 5xx response. That exception carries almost no useful information, and there is no way to inspect the response body or headers to decide what to do next. Setting muteHttpExceptions: true tells Apps Script to return the response object regardless of status code, which means you can call getResponseCode(), read the Retry-After header, and decide whether to retry or surface the real error message to your logs.
The tradeoff is that you now own the error-handling path completely. A 404 and a 429 both come back as normal return values. That is why the function above explicitly distinguishes retryable codes (429 and 5xx) from client errors like 400 or 403, which should not be retried because a retry will produce the same result.