you have one of the cases where the optimizer searching for a good solution costs much more time than the query it self, but that can change with increasing numbers.
You should read about what this optimization switch does.
if you need more speed you can try if one of https://dev.mysql.com/doc/refman/8.0/en/switchable-optimizations.html work better. ...
What could be the reason that even with Auto Update Statistics enabled and level 130, the statistics are stale?
Automatic statistic updates are not enough
You should be proactively updating statistics (more often than Auto Update Stats does) with FULLSCAN, to get better cardinality estimations and better query execution plans.
For more info watch this (...