I mean we already know switching to a keto based diet can have massive effects on the brain, it's been used to treat seizures since the 1920s, so it's not surprising it would have more effects.
And fasting has been a part of human spiritual (read: "psychological") practices for millennia. It's no surprise that it does something to the psyche.
Regardless of spiritual or psychological practices. Fact is food was generally nowhere near as available as it is now for the vast majority of our evolution as a species.