osascript with System Events seems to work for opening the right modal in Settings and flipping the switch On, in a quick test.

I did not verify whether it works reliably.

If it does, one could probably package it as a .app and grant only that the Accessibility permission.