Would simply adding pull_image after line 657 resolve the need for explicitly pulling the image before the rebuild? I.e.
# If the image being bootstrapped is not the base Discourse image
if [[ ! X"" = X"$base_image" ]]; then
image=$base_image
# Attempt to bring the image up to date
pull_image
fi
This will cause a docker pull $image to always happen during a bootstrap/rebuild of a container with base_image set in its yml file. I don’t think that hurts for mail-receiver if it happens to already be up to date but I’m not sure if there are other situations where that could be a problem.