Fix inf. loop when handling syscalls

This fixes the issue with a traced children when a child creates a process tree (fork/exec calls in each child), and then does some other weird things and execs to itself.

I tried hard to isolate the issue with a test case but couldn't reproduce. Though, I was able to debug the issue using gdb with the problematic "reexec" code we have and verified that it's fixed locally and on a buildbot.