I think it helps to think about the geometric aims here and when they conflict.
If the target length is low, this keeps the curve closer to a straight line. Clearly a straight line cannot lie between the 2 fixed end points on the curving surface - just because a destination is 100m away at 10m greater elevation doesn’t mean a route exists that can drive you there at a constant 1:10 slope.
Because the 2 aims are conflicting, their relative strengths will control which one is violated more.
If you increase the pull strength enough to force it to lie on the surface it will have to violate the length goal, meaning it no longer has constant slope.
If the target length is long enough though, there are multiple ways the curve can stay on the surface and keep constant slope. Both goals can be exactly satisfied.
However, starting with the target length high could cause the curve to rapidly crumple and overlap. It seems to work better to gradually increase it until it can lie fully on the surface, and with the desired slope.
If the constant slope goals are strongly enforced throughout, the path shouldn’t be able to cross itself, since it never goes back downhill, so I don’t think additional Collider goals should be necessary.
The bending goal also conflicts with the constant slope aim, since to turn smoothly at the hairpin bends means at one point the path is pointing directly uphill. The wider radius turns you have, the more earth you will need to move to build a non tilting path.
Here’s the file including the sweep of the road surface. I used a data dam, because you don’t want this to have to calculate for every update while still finding the path.
pathslope3.gh (196.9 KB)
To answer the questions in your notes on the gh file - the ‘rod’ goal is the same as creating length and angle goals, just sometimes more convenient to use.
The fixing of Z values for points on the curve is what enforces constant slope, since if each segment is the same length, and its end points are the same distance apart in Z, they must have the same slope.
I think it should be possible to get to a desired slope range just by adjusting the relative strengths of the goals in the existing setup.
If you did really want to control the limits of the slope range directly though, ClampAngle could work, or perhaps more simply, just use the same setup as above, but with a ClampLength goal for each of the segments. Since the height difference of the end points is enforced, you can easily convert between slope and length.