core/sched fixup and optimize

* fix some misuse of variables (mixing `tcb_t` and `pid_t`)
* fix condition logic (`X && Y != Y` -> `X && (Y != Y)`)
* refactor `SCHEDSTATISTICS` to make it faster/more readable
* remove obsolete/done TODOs
* remove stray spaces
* remove `last_pid`/`thread_getlastpid`