It looks like there are reports about this in the repo for gh-pages
npm package. See #347, #236, #370, #213.
There is even a still opened merged pull-request that tackles the issue through documentation.
Basically, it says:
Modify the deployment line to your deploy script if you use custom domain. This will prevent deployment to remove the domain from settings in github.
echo 'your_cutom_domain.online' > ./build/CNAME && gh-pages -d build"
Edit: there are other options as well, some people directly change their deployment call and add a custom domain to their deployment scritpt:
var ghpages = require('gh-pages');
var fs = require('fs');
fs.writeFile('dist/CNAME', "your-custom-domain.com", function(err) {});
ghpages.publish('dist', function(err) {});
others just follow the advice for putting CNAME
to your publishing folder.