Why is my uninstall webhook receiving incorrect shop value?

I have a webhook endpoint to handle the APP_UNINSTALLED event. Most of the time everything works well, however sometimes we receive the webhook with an incorrect shop value. In these cases, the shop value turns out to be the website domain.

Example

Merchant’s website domain: test.com

Merchant’s shop: test.myshopify.com

In the above example, our webhook endpoint received “www.test.com” instead of “test.myshopify.com”.

Why does this happen?