Is it possible to add some kind of PIKE_DEBUG-enabled code in get_all_args that detects these kinds of problems?
Not really, no.
We've been talking about a noop preprocessor that applies additional compilation checks before. Additional sprintf checks lands in the same area.
Historically you would use a program like "lint" to check stuff like this, without actually compiling anything. I think making something like that using Parser.C would be the way to go.