rpl_mdev382 tests, besides other things, binlogging of implicitly emptied MEMORY tables.
The assert that fires is here:
Indeed, the "statement transaction" is not supposed to be started. But the check_prepared_statement call above opens all tables, and the "implicitly emptied" MEMORY table too, which triggers binlog write, which starts the transaction.
Besides an assert it might be wrong on other layers too. What if the transaction is rolled back? What if the statement fails and is rolled back? DELETE must still be in binlog, strictly speaking it's not part of the transaction.