Set different posts_per_page for custom post type/taxonomy

A taxonomy term page isn’t a post type archive. Use is_tax() instead. Also, is_main_query() could be failing because it is not the main query. I know, obvious right. Without the rest of your php code, it is hard to tell. But the “main” query would be the query getting all the posts with that category. If this query is custom, or secondary, is_main_query() will fail.