With every major release DB_TYPE_FIRST_DYNAMIC changes so dynamic engine plugins shift IDs with it. FRM files are not automatically updated which can cause issues in code that uses these IDs.
For example in 10.2 an engine will have ID 44, in 10.3 ID 44 is reserved for DB_TYPE_SEQUENCE. When a TRUNCATE is called after an upgrade MariaDB calls certain functions in the SEQUENCE engine instead of the intended engine plugin which can cause a crash.
The only workaround appears to be "ALTER TABLE comment=''"
There are several ways this could be solved. mysql_upgrade should probably be aware of this. Maybe the start ID for legacy_db_type should be something high like 100?