Hi Carlos,
I have also faced this problem many times. Apparently I have come up with an easy solution.
Just create one schedule action with any model. Add the following script in the code section and Run it manually. Then Refresh the view and you will have the images restored, If all images are available at their required locations.
Here is the script you can run.
menus = env["ir.ui.menu"].search([("web_icon", "!=", False)])
for menu in menus:
menu.write({"web_icon_data": menu._compute_web_icon_data(menu.web_icon)})
I have used it in versions from 13-17 and will continue to be useful in upcoming versions, Until they change the way of loading image. This way you do not have to upgrade the whole system by with base module.
Thank You.