While this isn't impossible to do with blender at the moment, but its not something you can do easily, and doing this via a script would be very slow.
It would involve 2x modifier stack calculations per frame change.
- Add a frame-change-post handler.
- this handler must update the scene -
scene.update() so the data it deals with is valid before you start to operate on it.
- get the final calculated mesh and inspect its normals.
- modify the original meshes vertex groups how you like.
- throw away the copy of the mesh, only generated to inspect normals.
- tag the mesh to be updated
- and run
So officially this kind of thing isnt supported, and what I have suggested is very much a hack. Ideally modifier plugins would much more easily allow this functionality.