After some investigation, I found out the solution to it. I had to do pthread_sigmask(SIG_UNBLOCK, &set, NULL);after the each fork() calls and before exec() in the grand child. This caused SIGKILL to not get blocked.
pthread_sigmask(SIG_UNBLOCK, &set, NULL);