Apple has taken this to a new level with macOS Ventura.
In Ventura, this yields:
error "System Settings got an error: AppleEvent handler failed." number -10000
Note: In Ventura, the above script gets automatically changed to:
tell application "System Settings"
tell pane "Keyboard"
anchors
end tell
end tell
I was first aggravated by these changes* when I discovered that the macro Set Sound Output was no longer working with Ventura.
*Actually, that's not true. I was first aggravated by these changes when I opened the System Settings
application after "upgrading" to Ventura.