From reading the manual `unshare CLONE_NEWPID` acts on the calling process, not the child. Calling this multiple times seems redundant. After the 1st call all children are in a new pid namespace.
To put them in there own, you need a different parent to call `unshare CLONE_NEWPID`.
Try
repeat:
fork
if child:
unshare CLONE_NEWPID
spawn
This is all untested, and just what I would try next. I am also reading that you need to use `clone`.