What I understood from youtube gurus, take it with a grain of salt, is that your brain is taking ketones as source of energy to preserve the little glucose that goes into the system, and as result it consumes less oxygen.

But I'm not sure the mouth taste comes from the brain's waste.

To some degree, if you had your brain inflamed by bad eating habits, fasting would revert that and make the flushing more efficient as well.

Again please take with with double grain of salt, since I don't even know inflame brain is a thing for sure, or the correct term.