Investigate whether property paths instead of unions works better and change them and use them.
For instance, topic identification:
{ ?work wdt:P921/wdt:P31*/wdt:P279* wd:Q52 . }
union { ?work wdt:P921/wdt:P361+ wd:Q52 . }
union { ?work wdt:P921/wdt:P1269+ wd:Q52 . }
Property path:
?work wdt:P921/( wdt:P31*/wdt:P279* | wdt:P361+ | wdt:P1269+ ) wd:Q52 .