I have resolved the issue. For anyone who might encounter a similar problem in the future, you will need to instruct Alfred to reload the workflow. Unfortunately, this information is not documented anywhere; I discovered the method name by examining the python alfred-workflow library. Here is the snippet:
ObjC.import("stdlib");
function run(argv) {
let query = argv[0];
let app = Application("com.runningwithcrayons.Alfred");
let bundleid = $.getenv("alfred_workflow_bundleid");
app.setConfiguration('variable', {
toValue: query,
inWorkflow: bundleid,
exportable: false
});
app.reloadWorkflow(bundleid);
}