That is completely insane, a complete trust breaker.
Even worse, apparently the solution was for the customer to contact Gitbook to "resolve" the issue that would not have happened had the DNS records been honored.
What DNS change? Your request for $hostname is arriving at their servers, same as before.
Cloudflare has an entry in their system that $hostname is to be routed to service $foo.
I imagine you also have an entry in your domain name table that says I want $hostname to go to $bar. But that probably has lower priority that the list of rules that route traffic internally.
So again, nothing to do with DNS. The server that services a web request doesn't know anything about how DNS resolution worked. It just knows it has a request for a hostname, and that it arrived at a particular IP address.
Sure I understand the bug, but when that service is also a DNS provider then it should understand that when I change the DNS record to $bar then I don't want it to route to $foo any more.
Even worse, apparently the solution was for the customer to contact Gitbook to "resolve" the issue that would not have happened had the DNS records been honored.