The following assertion could fail during InnoDB crash recovery or mariabackup --prepare if data files with unflushed changes were closed by fil_system->LRU and later reopened due to pending I/O:
It is possible that this has been broken ever since MariaDB 10.2.2, which incorporated the InnoDB changes from MySQL 5.7.9. The fil_space_t fields are a recent addition.
The problem is that the function fil_node_t::read_page0() is replacing the up-to-date metadata with an old version of page 0 that is being reread from the file. A more up-to-date page 0 still exists in the buffer pool, not flushed yet.
In MDEV-16526, perhaps we could make it so that before files are closed, an attempt to write back any unflushed changes will be performed.