Is wp_insert_post exactly the same as publishing a post through the core UI?

There’s a bit more to the answer than just wp_insert_post(). That is the canonical way to insert a post and what the Classic Editor used to submit all of the post information at once.

The REST API (and thus Gutenberg) changes it a tad but running wp_insert_post initially just to setup a post in the db, then separately adds all of the meta data and taxonomies, etc (see https://core.trac.wordpress.org/browser/trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php?rev=49172#L577 ).

In terms of Jetpack’s Publicize feature, wp_insert_post will work just fine. We look for the wp_insert_post hook to sync up the post data used for the social media share ( https://github.com/Automattic/jetpack/blob/master/projects/packages/sync/src/modules/class-posts.php#L118 ).