The SectionRef class's has_trueparent comes closest to what you want. In practice, the absence of a more general function is not a problem because, with few exceptions, each child section should be attached to its parent's 1 end.
It is never a good idea to connect a section to its parent's 0 node, unless its parent is the root section of the model cell.
It is almost never a good idea to connect a section to an internal node, because the actual location of the connection may change if nseg changes. In most situations where one is tempted to attach a section to an internal node, it is probably a good idea to break the parent section into two sections, and attach the child to the point where they join. The only exceptions to this are:
1. A soma to which many neurites (dendrites and maybe one or more axons) are attached--although in most cases one could specify soma.nseg=1 and attach all child branches to 0, 0.5, or 1 without significantly affecting simulation results.
2. A dendrite that has multiple spines. In most cases it should be possible to assign an electrotonically-appropriate nseg value to the dendrite, which would mean that each segment is many 10s of um long and has multiple spines attached to it. However, if one is specifically interested in interactions between neighboring spines, it might be appropriate to make nseg very large so that each spine is attached to its own segment.