Andrew Gwynne’s decision to stand down as an MP offers by-election opening for Labour rival to prime minister