Yes, it's messy arc length calculus.
We can start with the relation between radius and true anomaly, which is rendered here in a form applicable to all conic section orbits by using the periapsis $p$:
This is to be combined with the arc length differential
Direct substitution leads to
Unless $e=0$ (circular orbit) or $e=1$ (parabolic orbit), integrating this requires elliptic functions, and that is a bridge too far for me. More practical for your problem seems to be leaving the relation in differential form, updating the derivative with each timestep.