Adding a menu option with the non-crashing behaviour as default? (Problematic camera -> no refocus). That would let those cameras run set_zoom'ing scripts without crashing, at the expense of possibly incorrect focus after zoom.
My initial reaction was set_zoom only affects script and USB remote, so maybe the control should be in script, but thinking more, menu gives users an option to have the old behavior without modifying their script.
OTOH, if someone writes a script that does need to restore focus after changing zoom, they either have to override the menu option, or re-implement the logic in script. Logic implemented by one person for a script is likely to be less portable and widely tested than the built in logic.
Another approach would be
set_zoom(step, do_refocus)
where do_refocus defaults to either false, or the menu option if both are implemented. This would let scripts that actually need to preserve focus use the built in logic. They would still crash on problem cameras, but if the script actually needs it, the same logic in script would likely crash too.
I'm just thinking out loud (and maybe overthinking) at this point.
Oh, and a related but different issue: the incorrect distortion when not using CAM_USE_ALT_PT_MoveOpticalZoomAt. I suspect that almost all D4 and later cameras need the alternative zooming method as distortion correction and distorting lens designs were introduced in DIGIC 4 cams.
I think this is correct. IIRC D10 was an exception (D4 cam that doesn't need) but the vast majority should have it.
I seem to recall some discussion whether it gives distortion correction equivalent to the using the physical controls.
edit:
I noticed modern cameras (~ixus160 and later) have UIFS_MoveZoomToPositionWithTaskSwCtrlServ_FW, which kind of suggests a higher level function. It appears to take 3 parameters