Condition the usage of variadic callback by version (#16112)
For older versions of custom ops, optional and variadic callbacks are
null pointers, hence adding conditions to scope the usage.
---------
Co-authored-by: Randy Shuai <rashuai@microsoft.com>