Hi @rohankalra ,
Your requirement if i understood right, what ever you tag in component's dialog it should return all the pages that has the tag authored in dialog. you can use query-builder for this and return the list of pages in sling model.
path=/content/<my-project>
type=cq:Page
1_property=jcr:content/<pageProperty>
1_property.value=<tag_added_in_dialog>
If your requirement is to get pages based on tags, you can also use existing list OOTB component for the same, it has build list using tags option which suits this scenario
Hope this helps,
Krishna