How to create a transient that persists the data for the whole duration of the expiration, even when object cache is enabled?

I eventually used a combination of update_option and WP Cron:

// Create the option.
update_option('foo', 'bar', false);

* Schedule it to be deleted one week from now.
* @param int Expiration timestamp
* @param string Hook that will be invoked
* @param string Params to send to the hook callback
wp_schedule_single_event( time() + WEEK_IN_SECONDS, 'expire_option', [ 'foo' ] );

// Register the hook.
add_action( 'expire_option', 'expire_option_callback', 10, 1 );

// This will be called by WP Cron when we want to "expire" the option, one week after its creation.
function expire_option_callback( $option_name ) {
  delete_option( $option_name );

The only drawback is that the option won’t be expired if WP Cron is not working in the site. If this is unnaceptable, you’ll need a more robust solution mimicking how transients are saved and expired in the DB.