The BaseURL in config.yml is set to /.
The domains.sh holds the URLs for Production Build and Stage Build.
do-dev.sh takes just the BaseURL from config.yml. When it comes to Stage or Build Production the BaseURLs are taken from do-prod.sh or do-stage.sh. And those are feeded by domains.sh.
Although this is a convenient way to create different builds be aware of the risk of the source command in the do- files. If you like to know more about it: Google is your friend.