Get ID of current taxonomy in register_rest_field

The get_callback part is generated within the WP_REST_Controller::add_additional_fields_to_object() method with:

$object[ $field_name ] = call_user_func( 
    $field_options['get_callback'], 
    $object, 
    $field_name, 
    $request, 
    $this->get_object_type() 
);

That means the callback has four input arguments:

'get_callback' => function ( $object, $field_name, $request, $object_type ) {
    // ...
}

and for the requested category object, we can get the term id with:

$term_id = $object['id'];