Build system: by default, merge the base branch early when building (#12557)
Previously, when we run `rake build` in a non-base branch it will be run at the Git state before the base branch merge, resulting in mixed Git state. And since the merge happens in auto/build it will obviously also be run in an pre-merge state. This can cause all sorts of subtle build errors. So let's move this merge earlier, into the Rakefile, so only changes there can be mixed. Also, this builds a foundation for completely eliminating this mixed state (soon!).