One way to do this is to use fnameescape:
But it may not be perfect if the command has spaces. You could also try split(@")->map('fnameescape(v:val)')->join(' ') in the expression, or some combination of shellescape()/escape(…, '%#'), etc.
Possible answer derived from https://vi.stackexchange.com/a/10211/8846 - doesn't function in quite the same way, but :.w !fish does send the text to a new shell literally and returns the correct answer.
It also makes it easier to write short python or other language programs instead of shell script, which would be an advantage.
As a slight workflow adjustment, I would use :make (or possibly :Make from the dispatch plugin) to build. Then I would run :terminal ./overlay & for the program part. This gives you a window running exactly that command. (There’s also :Dispatch, and maybe :Start/:Spawn, from the dispatch plugin. All are async when possible and come with foreground and ...