How to make the texture not follow the mesh deformations (Bouncing and stretching ball)
So I got the solution. I used lattice to deform the mesh. However if you rotate the lattice in edit mode, the texture will follow the mesh. But if you rotate the lattice in object mode, the texture doesn't follow the mesh. If you rig some bones to deform the lattice, and have them rotate the lattice as well, the texture will follow the mesh again because the bones seem to rotate lattice points, not the lattice object. However if you rotate this armature in object mode, it will rotate the lattice as object as well. What I did was, I used a second armature to rotate the first and consequently the lattice. I also hooked up the lattice deformation bones in the first armature to copy the location of some bones in the second. This meant I can deform lattice points as well as rotate it as a object in one armature/rig.
I am not the best at explaining so I'll link the files here if you wanna understand how to do this.
Here's the first file that I was struggling with. In this file the texture follows the mesh and is not independent: https://blend-exchange.giantcowfilms.com/b/lgJWddwp/
Here's is the file with the problem fixed. In this file the texture doesn't follow the mesh and can be controlled independently from the mesh deformation: https://blend-exchange.giantcowfilms.com/b/en23nWJl/