This issue was found during the testing of
MDEV-24621, by an intermittent failure of the test innodb.insert_into_empty. The failure occurred during the ROLLBACK of an INSERT into a table that was empty.
I was not able to repeat a failure on 10.6, but I think that a similar race condition is present. When we are computing statistics for an index tree, we failed to check whether an insert into an empty table is in progress by an active transaction. If yes, we should do what MVCC reads do: pretend that the table is empty.
No crash or other problem is known in the current 10.6 or in 10.7, but I think that it is better to treat this situation in a safe and consistent manner.