In UnityEditor, VRCConstraint component inspectors have "Activate" and "Zero" buttons, which calculate rest value and offset value internally. When it comes to adding them from C# script, we have to calculate offset value manually since the "Activate" method is not public in API.
The calculation process is not obvious and a bit complicated, so providing existing implementation may be helpful. Is it possible to expose the procedure as a public method like “ActivateAndPreserveOffset”?