Subcategories have their very own class in the body tag.
For example, in https://meta.discourse.org/c/support/wordpress/21, Support > WordPress is a subcategory of Support.
The category class on <body> is: category-support-wordpress.
If you want the banner to be displayed in the subcategories as well as their parent, the SCSS code should be different. I can have a look tomorrow.