Opt 1 has too many flaws.
Opt 2 had a clear mistype in line 3, I had to change “NULL1” to “COMPX”:
L1 = comp("COMPX").layer("Null 2");
P1 = L1.toWorld(L1.anchorPoint);
L2 = thisComp.layer("COMPX");
L2.toWorld(P1)
After that, the null follows the leg:


That’s what you are looking for, right?