I've done this sort of thing for a number of different reasons, usually involving driving emacs code from perl.
For example, I've written test code in perl that spins off an emacs window, and captures an image of it. The parent perl process then kills the emacs, and examines the image to see if it looks okay (has the right number of colors, for example).
The work around that I had in mind was to run the child with a munged program name, then do a "ps ax" listing, and
grep for the munged name. That would get me the actual pid of the child to kill. Your idea looks a bit simpler (if a little less surgical).