This was a regression from the patch for MDEV-7668. A test was incorrect, so the slave would not properly handle re-using temporary tables, which lead to replication failure in this case.