Can the ‘Drum Kit’ button be called from the API?
No, you can only read or modify the “raw” sample mappings. You can put something together that effectively does the same thing, but beware: the drum kit mode is a bit special.
If you, as a user, has pressed the ‘generate drum kit’ button, the sampler actually switches to a special mode in which mappings are restricted to the selected drum-kit layout, in realtime.
You can check this e.g. by creating a new sample in the instrument - it should be assigned to a key range instead of spanning the entire range.
This also means that, if the user has activated this mode, you would not have to do anything to achieve what you want. But, unfortunately, this is not a a “proper” solution because, as you pointed out, you can’t activate the drum-kit mode using the API. You can however detect if the mode is active - based on the fact that a newly generated sample will occupy a small key range, and not the full key-zone.
So, bottom line is: for now, you will have to generate/maintain those layouts yourself…