I added an equivalent script after we moved to Cloudflare. I found it's easy to make a mistake in the Cloudflare DNS web interface, e.g. it's easy to accidentally remove an entry.
Now, at every deploy to production, we do a backup of the DNS configuration on Cloudflare and save it on S3. This hardly costs us anything as each backup is only a small text file. But I now feel much more comfortable when editing our DNS config.