Custom Post Type shows pagination (w/404) or posts_per_page query, but not both

user5477769 reports in the comments of the original post, that the problem has been solved:

I was following Custom Post Type UI instructions but it seems it led
me astray. Creating a archive-gallery.php with a vanilla Loop, along with
removing is_main_query has solved all problems, and the pages now show
with 9 posts and correct pagination.