That's a logical and an expected question and it negates the usefulness of this function IMO.
So is there an API that can be used to retrieve all tags related to a specific course? Don't see it listed at https://docs.moodle.org/dev/Web_service_API_functions. Also, the API doesn't seem to have enough documentation for each API usage so not sure I've tested them all.