I've never tried but have a look at the SocialPolicyPopup.lua around line 609. The pipe graphics are determined by the relative locations of prereqs and policies, based on a grid system for each policy branch's panel. In line 609 it steps through all the prereq-policy relationships and compares their grid locations, setting which curved (or straight) end pieces to use for the pipes between them.
The for loop at line 653 seems to add the long straight pipe sections between policies, again based on the grid system. A pipe image is requested from GetPipe() (which automatically links it to the proper policy branch panel), then the position is calculated based on the positions of the policy and prereq, then the appropriate texture is chosen (vTexture or hTexture for a vertical or horizontal pipe). On the vertical only relationships with distance greater than 1 are taken into account, since when we add the two ends of the pipe later they will add up to 1 'Y-unit' in the grid already (since the space between policies vertically is less than on the horizontal).
The next 2 for loops are for the connecting curves at the end of pipes, the first for all curves pointing down and the second for curves pointing up. These loops simply go through the curves we found back in line 609, creating and positioning each one.
If this system isn't working properly I'd guess something isn't right with the policy-prereq relationship between those two, because it looks like it should all be automatic. Also I'd make sure all the policies in that panel have the same PolicyBranchType, otherwise GetPipe() will not link the pipe graphic to the right panel.