If it's only through her "leg holes,"then I guess this won't work, but if it is through her waist band as well, then this might work. Or, you could criss cross it through, underneath her legs for tighter "reinforcement."...
My daughter did the same thing at about that age too. In fact, the first time was at a relatives home, we were spending the weekend there. My niece and my daughter were playing in her room; before everyone else was awake. When we awoke, their hallway wall was totally "repainted" with her poop. From there on, it continued at home, mostly during naptime too.
The only thing, after a million other things, that we tried, and it worked, was "TAPE." We wrapped it several times around her diaper; and not "Scotch" tape or the like, it has to be "STRONG TAPE." When she is up from her nap, everything should still be in tact. When you are ready to change her, just cut carefully through the tape.
It doesn't look to pretty, but believe me, the tape is much prettier to look at than "a big poopy mess!"