How to update mark-up of a gallery block in a custom theme?

If you want to adjust the HTML of a Core block, one option is to add a filter on the render_block hook. This allows you to use PHP to modify the HTML output, so you don’t have to set up a whole Webpack setup and use newer JS. If you place this in the (child) theme, this will also allow the site owner to automatically swap back to normal Gallery block markup if they switch themes, so non-Bootstrap themes won’t break the block.

The downside is, the filter runs after WordPress has already retrieved the content, so you’re looking at slightly longer processing times of the final markup. This shouldn’t be too big of an issue for most sites, especially if you have some kind of caching set up.

You can find documentation on render_block on the WP Developer site.