core/sched fixup and optimize

* fix some broken misuse of variables (mixing `tcb_t` and `pid_t`)
* fix condition logic (`X && Y != Y` -> `X && (Y != Y)`)
* fix setting and use of `thread_active_pid`, includes optimizations
* refactor `SCHEDSTATISTICS` to make it faster
* remove stale TODO and double spaces
* update documentation with regard to `last_pid`/`thread_getlastpid` availability
That would make sense, but I'm more on the "let's just remove it" side as well (unless it's always there).