Temporary tables have no locking. They are intended to be accessible from
within a single thread only.
However, with parallel replication, all worker threads have access to the
same temporary tables, in case of statement-based binlogging on the master.
However, it is still possible to get two worker threads to try to
simultanously use the same temporary table at the same time, if the user
creates two transactions with different domain id, using a single temporary
table. This would be user error, and it is ok for it to cause replication to
stop with an error, or even silently diverge. But it should not crash the
server, which seems entirely possible to happen with current code where
there is no locking.