How to achieve dynamic cloth pinning?
There is no simple solution to this.

Animating the group itself is not a problem, you can use the AnimAll addon or just stack multiple vertex groups with the Vertex Group Mix modifier where you can animate the influence of participating groups on the final one.

The problem is that when you need to change the pinned vertices, you need the simulation to continue where it ended the frame before. But the simulation will not pin the vertices where they currently are, but where they were before the simulation started. Those newly pinned vertices would just jump from frame to frame to their un-simulated location.

To solve this in Blender, you need to create multiple simulations that closely start where the previous ends (and they need to start-end with similar motion also). Then you need to create one extra mesh so you can interpolate between all those simulations and smooth merge them into shapekey animation:

How to bake softbody animation into keyframes?

You will have to modify the script to sample from multiple meshes and to smoothly transition between them, but most of the code is there.

When sampling the simulations you take locations from first simulation and when you approach the second you smoothly switch to it's vertex coordinates.

The results can be very good and convincing. It is common practice in many simulation applications when the simulation is not precise enough like you want and you need to hand sculpt some key poses of the cloth into the simulation.

If you want to avoid the scripting, you can also use multiple Mesh Deform modifiers to those simulations and then blend between them with influence. But when your simulation changes, you can simply re-run the script while otherwise you need to rearrange, re-bind and re-animate those modifiers.