In Microsoft's SETATREF documentation:
https://learn.microsoft.com/en-us/office/client-developer/visio/setatref-functionit says this:
"If shapes are glued, Visio follows the SETATREF reference chain within the same sheet and places glue formulas in the referenced cell."
When I glue shapes in Visio 2019/2021 desktop (gluing them together on one of the connectors of each shape), there are no SETATREF formulas however there are formulas like this:
=LOCTOPAR(PNT(Square.2!Connections.X1+20 mm,Square.2!Connections.Y1+20 mm),Square.2!EventXFMod,EventXFMod)
Maybe this changed between Visio versions, or:
Do you maybe get SETATREF() formulas when you glue shapes to their respective geometries, haven't ever used that however.