A wp-cli command of your own is one class and one register call

Anything run more than twice against a site — a reindex, a backfill, a report — is better as a command than as a page in the admin with a button on it.

if ( defined( 'WP_CLI' ) && WP_CLI ) {
    WP_CLI::add_command( 'turkerdev reindex', function ( $args, $assoc ) {
        $limit    = (int) ( $assoc['limit'] ?? 500 );
        $progress = WP_CLIUtilsmake_progress_bar( 'Reindexing', $limit );

        foreach ( turkerdev_pending( $limit ) as $id ) {
            turkerdev_index( $id );
            $progress->tick();
        }

        $progress->finish();
        WP_CLI::success( "Reindexed {$limit} items." );
    } );
}

The guard is what keeps the command file harmless when loaded by a web request. A progress bar costs one line and is the difference between a command people trust and one they kill after ninety seconds assuming it hung. WP_CLI::success and ::error set the exit code, which is what makes the command usable from a deploy script rather than only by a human.