url rewrite – Wrong Product URL when found via category on M2

I am using Magento version 2.3.1 EE and I observed that some of the product page URL’s are coming wrong when found via category even if the URL rewrites are created in the Magento admin. It is happening only for few products in the category, rest all products are working fine.

URL coming when found via category https://staging.tradingdepot.co.uk/catalog/product/view/id/74012/s/merlyn-8-series-walk-in-with-swivel-panel-with-end-panel-900mm-m80291sv/category/4490/

Actual URL should be

URL rewrite is created for this product and no duplicate URL rewrite is created. Also we have tried creating URL rewrite through olegkoval/magento2-regenerate_url_rewrites but still it picks the wrong URL and when we change the URL key of product and then save the product. In that case product URL gets corrected and new URL starts showing which is the correct URL.

Please help me out with this probelm.