lib: Simplify code flow in _resolve_message_id_to_thread_id