This is definitely (still) upstream in tp_detect_thumb_while_moving(). I have 1.12.0-1, identical to HEAD evdev-mt-touchpad.c as of right now.
The assumption that there is one (or more) new TOUCH_BEGIN touch and one (or more) older TOUCH_UPDATE (not _BEGIN or _HOVER or _NONE) touch is false. Here are two touches that triggered this bug for me, extracted from a core: { tp = 0x55952647f5e0, index = 0, state = TOUCH_BEGIN, has_ended = false, dirty = true, point = { x = 167, y = 3432 }, time = 29468145253, pressure = 0, is_tool_palm = false, major = 152, minor = 264, was_down = true, quirks = { reset_motion_history = true }, history = { samples = { { time = 29468121253, point = { x = 113, y = 3477 } }, { time = 29468129254, point = { x = 115, y = 3475 } }, { time = 29468137199, point = { x = 129, y = 3460 } }, { time = 29468145253, point = { x = 167, y = 3432 } } }, index = 3, count = 1 }, jumps = { last_delta_mm = 0 }, hysteresis = { center = { x = 167, y = 3432 }, x_motion_history = 0 '\000' }, pinned = { is_pinned = false, center = { x = 2818, y = 2976 } }, button = { state = BUTTON_STATE_NONE, current = 0, timer = { libinput = 0x5595264688d0, timer_name = 0x55952647f2e0 "event12 (1) button", link = { prev = 0x0, next = 0x0 }, expire = 0, timer_func = 0x7f8624ec3450 < tp_button_handle_timeout >, timer_func_data = 0x55952647fba0 }, initial = { x = 1647, y = 4150 }, has_moved = false }, tap = { state = TAP_TOUCH_STATE_IDLE, initial = { x = 1647, y = 4150 }, is_thumb = false, is_palm = false }, scroll = { edge_state = EDGE_SCROLL_TOUCH_STATE_NONE, edge = 0, direction = -1, timer = { libinput = 0x5595264688d0, timer_name = 0x559526481950 "event12 (0) edgescroll", link = { prev = 0x0, next = 0x0 }, expire = 0, timer_func = 0x7f8624ec4f70 < tp_edge_scroll_handle_timeout >, timer_func_data = 0x55952647fba0 }, initial = { x = 0, y = 0 } }, palm = { state = PALM_NONE, first = { x = 5023, y = 4326 }, time = 29468145253 }, gesture = { initial = { x = 1629, y = 4030 } }, thumb = { state = THUMB_STATE_NO, first_touch_time = 29468145253, initial = { x = -205, y = 5762 } }, speed = { last_speed = 27.794631398589125, exceeded_count = 1 } }, and { tp = 0x55952647f5e0, index = 1, state = TOUCH_BEGIN, has_ended = false, dirty = true, point = { x = 1456, y = 2133 }, time = 29468145253, pressure = 0, is_tool_palm = false, major = 135, minor = 203, was_down = true, quirks = { reset_motion_history = true }, history = { samples = { { time = 29468121253, point = { x = 1472, y = 2252 } }, { time = 29468129254, point = { x = 1460, y = 2206 } }, { time = 29468137199, point = { x = 1451, y = 2173 } }, { time = 29468145253, point = { x = 1456, y = 2133 } } }, index = 3, count = 1 }, jumps = { last_delta_mm = 0 }, hysteresis = { center = { x = 1456, y = 2133 }, x_motion_history = 0 '\000' }, pinned = { is_pinned = false, center = { x = 1740, y = 3448 } }, button = { state = BUTTON_STATE_NONE, current = 0, timer = { libinput = 0x5595264688d0, timer_name = 0x55952647f4c0 "event12 (2) button", link = { prev = 0x0, next = 0x0 }, expire = 0, timer_func = 0x7f8624ec3450 < tp_button_handle_timeout >, timer_func_data = 0x55952647fd40 }, initial = { x = 243, y = 5311 }, has_moved = false }, tap = { state = TAP_TOUCH_STATE_IDLE, initial = { x = 243, y = 5311 }, is_thumb = false, is_palm = false }, scroll = { edge_state = EDGE_SCROLL_TOUCH_STATE_NONE, edge = 0, direction = -1, timer = { libinput = 0x5595264688d0, timer_name = 0x559526481970 "event12 (0) edgescroll", link = { prev = 0x0, next = 0x0 }, expire = 0, timer_func = 0x7f8624ec4f70 < tp_edge_scroll_handle_timeout >, timer_func_data = 0x55952647fd40 }, initial = { x = 0, y = 0 } }, palm = { state = PALM_NONE, first = { x = 5044, y = 5262 }, time = 29468145253 }, gesture = { initial = { x = 239, y = 5243 } }, thumb = { state = THUMB_STATE_NO, first_touch_time = 29468145253, initial = { x = 1700, y = 6327 } }, speed = { last_speed = 46.728018982837312, exceeded_count = 9 } }, the rest were _NONEs