just to think at a different approach, I’m wondering if it would work to temporarily slide the seam of the curve on an unused location just for the purpose of creating the pipes
in a scenario like this, where P0 is a point where a pipe should be created, but also the start/end point of the curve itself
if you slide the seam in some remote location like this:
then you can create the pipe with your standard definition without too much concerns?
the location where to move the seam might be in the middle of the Length Parameter of the two most distant Points along the curve, in this case somewhere between Length Parameter of P1 and Length Parameter of P2 (easy to compare with shift list, and find the highest)

