Onebox fail with 429 error should still create valid <img> tags

On my Discourse forum users are encouraged to use external image hosting services when possible. The most common is Imgur, which after a while starts rate-limiting the Discourse server with a 429 error. While this is an unsolvable problem with Imgur, Discourse also doesn’t handle it optimally. Currently when Imgur throws a 429 error Discourse interprets it as if it were an invalid image link and it just displays the image URL with <a> tags. But there is nothing preventing individual users from viewing those images inline in Discourse since their browser and IP are different. Discourse should still generate valid HTML to display the image. For example:
This URL gets rate-limited on my server and Discourse just generates a link:
<a href="" target="_blank" rel="noopener noreferrer" tabindex="-1"></a>

But the following HTML works fine to display the image within the end-user’s browser, both in the post preview and in the baked post:
<img src="">
That is the HTML that Discourse should generate even if it receives a 429 when the server hits the URL, and it should only leave the naked URL if it gets a 404 error.