The table performance_schema.events_transactions_history_long that was imported from MySQL 5.7.28 to MariaDB Server 10.5.2 may report bogus trx_id values for InnoDB transactions:
For the first reported row, the trx_id may not be deterministic between test runs, because it is based on the value of trx_t*, computed by the function trx_get_id_for_print() and passed to trans_register_ha() by innobase_register_trx().
Yes, it is possible that no transaction identifier has been assigned to a transaction at the time when innobase_register_trx() has been called. In this case, passing the dummy value trx->id=0 would result in a preferred outcome: the TRX_ID would be reported as NULL.
We can also observe that GTID} will be reported as a dummy value '0-0-0' instead of more appropriate NULL. I will not report or address that for now.