I don't think this even _can_ be possible for a large number of programs.
For some small number of programs it _might_ be possible, if somehow (ignoring how for now) you were exposed some standard interfaces like getopt or argparse and didn't have to care about argument ordering.
But a ton of other programs, with extremely complicated interfaces, simply wouldn't be possible. And these include commonly used programs.
Auto-completing awk would require a full language parser at the least, for example.
Another, ffmpeg, has a dizzying array of options, and the order of those options can completely change the intent of the command, and what options are allowed to follow without being ignored silently.
Even if we had perfect interface detection, we could only probably generate a subset of auto-completion options because that particular problem might not _always_ be solveable.