Target is the name of the gateway, yes.
The layer itself won't tell you what policy package its used in as it can exist as part of multiple policy packages.
If you were to do it programmatically, you would have to list all policy packages (show-packages) and listing each package (show-package) to determine what layers are used within them.
The other option is to know via some other method which policy package(s) you're pushing beforehand.
In any case, only one install-policy action can be active at one time, so if you're updating multiple policies programmatically, you'd have to push one policy, wait until it finishes, then push the next policy, etc.