Click tag to filter by tag within queries (in preview mode)

Use case or problem

I have set up search queries to show future deadlines. However, there are quite a lot, and this is visually overwhelming. It would be useful to find some way to filter by tag.

Proposed solution

Make tags clickable in preview mode. When you click the tag, the tag is added to the search query. When you click on the tag again, the query reverts to its unfiltered state, i.e. the tag is removed from the query. (NB this is the way tags work in Org mode). For embedded tags you would need to click on the embedded part to filter by that tag.

Current workaround (optional)

This behaviour currently works within the tag view. However, it would be much more convenient if it also works within queries. An alternative is to edit the query to select a tag, but this is also not very convenient.

Related feature requests (optional)

The following is a similar feature request: Temporary Filter Settings Applied on Top of Embedded Queries. However, rather than have tags built into the query header, having clickable tags within the query would be even more convenient: