SHOW GLOBAL STATUS and INFORMATION_SCHEMA.GLOBAL_STATUS always invoke calc_sum_of_all_status() to aggregate values of global status variables from session status variables into a temporary buffer.
This is done even when no such aggregated variable will be returned to the user (e.g. because of LIKE 'uptime'. And calc_sum_of_all_status() can be rather expensive with many threads, see
MDEV-15135, so it's a waste to call it and not use the result.
The fix could be to call calc_sum_of_all_status() from show_status_array() when it stumbles upon a first variable that needs aggregation.