If the use case is more simple and limited to triggering a non Run JS query on the tab change, you can also try this approach:
Set a query to "run query automatically when inputs change" and reference the tab inside of the query's disabled option.
{{tabbedcontainer1.selectedTabIndex != 1}}
This counts as an "input" to the query, and will trigger the query each time tabbedcontainer1.selectedTabIndex recalculates. It will be disabled if the selectedTabIndex is not the second tab here, having the end result of triggering each time the selectedTabIndex becomes set to 1
For more involved logic though, you would need to build out a routing query like Ben has!