OK, I've spent some time on the icon 404 issue to try and really understand the problem / pitfalls:

I've create a Git repo here:
I've modified the approach to listen to existing DOM images / icons and the helper function lets you know if it's missing or not.
Performance is relatively slow vs an image error event (as it has to serialise and compare the image) but won't be noticeable in pretty much most meaningful contexts where you would load at max 10s or 100s, not 1000s of icons at once.
The harder part of the problem, is what to do about missing icons? It seems the only way for Chrome to have an icon in its cache is to have loaded the page in a tab.
Note: I have a LOT of missing icons above as I recently transferred machines.
Anyway, lots more detail and initial attempts to get to the bottom of these issues in the repo.
New ideas welcome here or as issues on the repo 🙏