Because the loading of sample maps is asynchronous: the call to Sampler.loadSampleMap() doesn't do anything heavyweight, it just posts a notification to the worker thread which kills all notes gracefully, suspends the audio rendering and then performs the loading & preloading until everything is done and then reenables the audio rendering for the ultimate smooth swapping experience.
Since this can take a few seconds for big sample sets, having the script engine in a busy-wait state is not an option (in fact, the time-out protection would fire). Hence you need to jump through the hidden Panel hoop.