Go has a fast enough compile speed I feel like you could syntactically sugar it to be a command line.
AFAIK the Go jupyter kernel does something like this but it sequentially links previous compilation results to the current cell. Memory use is probably not great for a shell care though (since each linked Go library is a whole separate Go runtime).
Many people have made micro Tcl’s too if you want something even lighter.
It has a built in subst command no need for a template engine!