Tags query based on another field selection?

That is possible but only after the value is saved, so doesn’t really make sense. You would have to create a custom field. See this thread: Programmatically change the content of the file field