I guess that it is expected that this kind of query result binding would work only with XML data structures.
You can bind arbitrary XQuery values to variables (XML, strings, numbers, binaries, maps, arrays, function items, and others).
Can any XQuery scripts be referenced by known file names at such places?
Yes, you can e.g. use xquery:eval for that purpose [1]. The result can again be bound to a variable and further processed. It can also be written to a file, sent to any remote source, an SQL database, or wherever you need it. You can regard XQuery as full information processing language, which includes database core features that resemble SQL.