Client|Plugin: Thread-safety for calling plugin hooks

Keep track of the active plugin ID per thread.