There are a number of issues with this mostly solved with __kpatch_[un]register are properly guarded with locks/mutexes.  Why increment kpatch_num_registered here when the registration isn't complete yet?

Why not increment/decrement it in kpatch_apply_patch()/kpatch_remove_patch()?  Then you can just check the value of kpatch_num_registered for registering/unregistering with ftrace (without the nasty inc/dec and compare).