Hello Phil Rees,
What you observe is correct, the way Repeat processing in handled currently is based on the last or current repeat.
One option may be to use join() function which should create a concatenated list of all XY coordinates. You can then use the substr() function to extract specific pieces of the list to calculate the distance.
Please use this link for reference regarding Formulas in ArcGIS Survey123: Formulas—ArcGIS Survey123 | Documentation
The issue then becomes configuring the calculation to accommodate dynamic point inputs.