Is there a way to make a polyline connecting two points that would only turn 3 times at maximum perpendicularly to itself? aka moving in x y and z directions on separate segments of the line.
Sure, that is very easy to do. You just find the vector between the 2 points and decompose it into x,y and z. Than you can draw a line and use the endpoint of one line as the starting point for the next.