ApiOptionsHook passes the array of changes that a user wants make, but doe not allow modifying.
Some extensions may want manipulate the changes array; for example to ensure existence of dependent options.
For example, WikimediaIncubator requires that if incubatortestwiki-project is set, then incubatortestwiki-code must also be set at the same time. The web UI enforces this and aborts save but the API does not and results in T290195 if the former is set without the latter.
WikimediaIncubator may want to aborts the save in API too, or replace incompatible values with default. Either solution would require improving ApiOptionsHook first.
The hook has two subscribers https://codesearch-beta.wmcloud.org/search/?files=&i=nope&q=onApiOptions