The global policies have to be executed for all the requests, it's by design. And, in theory, all the APIs on enrolled gateway should be managed/monitored by portal EE.
Therefore, it's not necessary to "distinguish those un-relative logic"
If you have some APIs have nothing to do with portal, you may think of another gateway cluster which is not enrolled to portal.