Previously when adding a new membership (e.g. adding someone to a thread) the memberships.last_message column was set to 1 (or 0 if it was supposed to be unread). But after landing D8492 we need the last_message to have a correct value so we now what latest message to fetch.
This really is only an issue for genesis because for other threads there is new message "<user> joined" that sets the last_message to the correct value.
This is an alternative to D8680 which I will abandon if this diff is landed.