Where exactly should I hook in order to change the post’s ID before insertion in the database?

I did this and it gave me a post with the set import_id:

    $my_post = array(
        'import_id' => 1234567890,
        'post_title'    => 'Custom ID',
        'post_content'  => 'This post has a custom ID.',
        'post_status'   => 'publish',
    );
    wp_insert_post( $my_post );

In addition this will raise ID/index to the integer you set in the import_id so that subsequent posts’ ids will be incremented form there (ie. 1234567891, 1234567892, etc.) – allowing you to use your large integer as a base for your posts with custom IDs.

Please give it a try and let me know how it goes.