core: refactor check for valid pid

~~I wonder if the checks should be carried out if `DEVELHELP` is defined only. I am not convinced however.~~

~~Regarding the test itself:
The first condition (`(pid != KERNEL_PID_UNDEF)`) is superfluous because it is part of the second condition (`(KERNEL_PID_FIRST <= pid)`) already. I only haven't changed this immediately because it I can't believe it is true *and* survived the review process ;-)~~

~~I'm not very happy with the name by the way..~~

Bonus: Add doxygen header for kernel_types (I will split this if the rest triggers too much of a debate).
Thanks