Auto-translated
Yes, that's correct; the script checks for the presence of heroes on the map, and for it, being inside a castle is the same as being outside of it.
In general, it's likely that the script malfunctioned; more precisely, it stopped at an error. The unlocking of the garrison probably occurred after Elain was removed but before the error with Peop1. Therefore, everything in the script function that came after Peop1 probably didn't execute.
Whatever