I think (but could be wrong) that it's done in this order :
clicking on mod in main menu -> copy data core to debug DB
clicking on single player in mod menu -> updating debug DB with mods data
launching game (before map script start) -> loading debug data by/in game engine
after this point, change to DB won't be applied (except for text)
That said, I haven't tried to make change in DB in a map script, but my feelings is that the loading of data from debug by the game is done before executing the script.