core: add `thread_get()`

Remove PID check duplication in `thread_getstatus()` and
`thread_getname()`.