Maya has a multilayered design, your talking of 2 separate layers. The gui and the node network. A button belongs to the GUI. Now the GUI is totally segregated form the computational layer, the DG and you may only pass info between these stages when maya is OFFLINE, that is when mayas not executing the DG such as playback etc. Theres a bit of other complication involved such as maya requiring* things to work even if theres no GUI present etc.
Normally you don't use this kind of design paradigm, button first, as its hard to change the animation after the fact of such systems. Animation is almost always refining existing things so change is the imperative in the workflow and buttons aren't easy to work with in bulk numbers. More importantly the, what, when, how and why a button exists is not of any interest to the DG.
DG is the real thing that drives maya, if you aren't communicating with the DG your dead in the water. So the key to anything in maya is to understand the available nodes (yes even if you make your own because they dont do anything without the other nodes). How you store it in a node is up to you it doesnt matter to the uesr or really you either.**
Once you eliminate the button, and yes it doenst really matter how convoluted setting the values on press are. Your question becomes:
What node do I store my data in.
Since the value in question needs to change then the straightforward answer as you store the data in one or several keyframe node(s). Mainly because its hard to justify any other way of doing simple value manipulation over time.
Now, the follicle is also not fixed, nor any other psoitional data, like you claim, you can use keyframe nodes to change the location of the follicle after its been set (because the stored data is numeric. configuration matters not for maya users). So for your situation the result of rivet mel is where you start now all you need to do is figure out how to keyframe this.
So to answer the quetstion for clarity once more:
How should I store that relationship (offset) between follicle and a bound object
so I can use it to reposition the object later?
You store it in one or several keyframe nodes. The keyframe node will take care of the data retrieval and setting. Api and nodes just provide attribute and does something for the data. As such all maya nodes allready have this mechanism so you dont need a extra node since the follicle allready has theese attributes.
Your GUI (or rather mayas default GUI since you dont need anything else) handles the values inside tha keyframe nodes by setting them as you need it offline. And letting maya handle everything esle.
PS: Normally you would not do any of this, but instead you would just make several separate rivets and use a constraint to the individual rivets and key the weight of each of the constrains channels instead then adding stuff becomes trivial. And since its normal workflow animators would know how to use it off the shelf, no buttons needed.
PS2: you could use a geometry constraint/closest point on to feed your data more user firendly.
- yes its a fixed requirement for people who intend to reder stuff out.
** please note I wouldnt waste time making this node because we allready have the ndoe in question and its the follicle, it allready stores the information thus i can animate it, i just need to tell maya im interested in doing so. But if you must you can store it the same way the follicle does this (UV). Then atleast your interchangeable with follicle nodes. Therefore you repurpose, big days job in one minute.