Most OBS developers seem to hang out on Discord, so if my notes here don't help, you might ask there.
All three settings are stored in the [BasicWindow] section of global.ini, (stored in C:\Users\your-account-name\AppData\Roaming\obs-studio on Windows)
Duplicate Scene is SceneDuplicationMode, Duplicate Sources is EditPropertiesMode, Swap Preview/Program is SwapScenesMode
You can read and write elements of an ini file using the functions described at
https://docs.obsproject.com/reference-libobs-util-config-file
I THOUGHT I had seen functions to deal with global.ini directly, but I am not finding them now, so I may be hallucinating even without ChatGPT.
Changing global.ini BEFORE you run OBS should work. Changing it while OBS is running is likely to be a problem: you would need to see when OBS reads and writes the file. It presumably reads at startup; I don't know if there are other times. Writing MIGHT happen when you change a setting, or it might happen only as OBS shuts down, in which case it might overwrite changes you made to the file while OBS was running.