There is currently a way to exclude specific "spatial relationship layers" from the list in the Query widget, with Web AppBuilder Dev edition.
You can add an array of Layer ids to the following variable in "PATH TO YOURAPP#\widgets\Query\TaskSettings.js" currently on line 459
var ignoredFeaturelayerIds = ;
It's tedious to list them all, especially in case you only want to display one or two layers and your map contains dozens and it often doesn't make sense to use those other layers for creating a spatial relationship.
And it's only possible if you deploy your app on your own server.
What I would like to see to enhance the user experience:
a) be able to set a default layer to be displayed automatically when "Only return features that have a spatial relationship with features in another layer" is selected
b) instead of ignoring, adding layers
c) The option to check the layers you want to use in the spatial query in the Widget configuration UI (similar to the selection widget: Set selectable layer(s) in select widget )
Thanks for consideration
Related post: Ignore Layers for spatial filter in Query Widget