Currently, when an InnoDB transaction is in the "System lock" state, it appears that it also performs tasks related to transaction registration, since this is done from ha_innobase::external_lock.
Should we create a new thread state called "Registering transaction" or something for this portion of the work?
For example, we can see that the server goes into the "System lock" state and asks the storage engine to get the external lock here:
And as part of that process, InnoDB calls innobase_register_trx():
which calls trans_register_ha() and trx_register_for_2pc():