The composite cosmological objects—Kibble-Lazarides-Shafi (KLS) walls bounded by strings and cosmic strings terminated by Nambu monopoles—could be produced during the phase transitions in the early universe. Recent experiments in superfluid 3He reproduced the formation of the KLS domain walls, which opened the new arena for the detailed study of those objects in a human controlled system with different characteristic lengths. These composite defects are formed by two successive symmetry breaking phase transitions. In the first transition the strings are formed, then in the second transition the string becomes the termination line of the KLS wall. In the same manner, in the first transition monopoles are formed, and then in the second transition these monopoles become the termination points of strings. Here we show that in the vicinity of the second transition the composite defects can be described by relative homotopy groups. This is because there are two well-separated length scales involved, which give rise to two different classes of the degenerate vacuum states, R1 and R2, and the composite objects correspond to the nontrivial elements of the group πn(R1,R2). We discuss this on example of the so-called polar distorted B phase, which is formed in the two-step phase transition in liquid 3He distorted by aerogel. In this system the string monopoles terminate spin vortices with an even winding number, while KLS string walls terminate on half-quantum vortices. In the presence of magnetic field, vortex skyrmions are formed, and the string monopole transforms to the nexus. We also discuss the integer-valued topological invariants of those objects. Our consideration can be applied to the composite defects in other condensed matter and cosmological systems.