Thank you for all your suggestions, sorry for the late answer. I did try to change the project to GLES3 as suggested by @TwistedTwigleg, and to check VRAM export options, but no luck.
However, changing slightly the keywords I got to this issue which seems to be the solution (I have yet to try it) https://github.com/godotengine/godot-proposals/issues/2177
Apparently, WebGL has problems with the kind of feedback loop I am implementing, which is illegal. According to the issue I should add a second viewport and transfer information between them. I will tell you how it goes. If it works correctly I will upload a clean version of the project with a small tutorial on how to do this kind of stuff with Godot, because seems that it is not trivial and there's not a lot of information about this.
EDIT: effectively this solved the problem and now it runs smoothly on web. The new setup is:
-- Sprite
-- ViewportA
---- ColorRect (with shader)
-- ViewportB
----- Sprite
Where ViewportB/Sprite texture is set to ViewportA's texture, and the "last frame" shader parameter is ViewportB's texture. The top sprite acts just as a renderer, taking ViewportA texture too. Note that ViewportA clear mode is set as "next frame", as before.
I will upload code to GitHub + tutorial after cleaning and polishing the project a bit. Thank you all for your help!!