Clever method for doing it there with the roads. I haven’t started on my road part yet but I was considering a similar way.
To avoid the tight angles you will want to get the current direction and only allow the new point to be within a certain angle eg. 90 degrees max.
On the Z trace 6ixpool is correct. Don’t try and do it from the root. Get the location of each spline point and then trace from there.
The way I have been doing my building generator at the moment is to create everything up in the air and then use a similar function to align using a box trace to align the buildings to the ground, then I do a line trace on each corner of the building to generate a foundation which takes the longest trace distance and spawns a mesh at that scale/10 +50 so that it digs into the ground so no buildings are floating.
I would advise doing the same with the road. Generate the road up in flat space only on the X,Y axis. Then run a function to do the Z axis alignment with your landscape. You can then at the same time run another function to align the landscape up with the spline to clean up all the gaps