core/msg: set m->sender_pid before it is used

fixes `msg_send_to_self` condition