In Civ 6 the Gandhi AI will actually never declare war on you, AFAIK. For the instance where a human player is controlling Gandhi and declares war, he has a unique cutscene where he lampshades the absurdity of the situation. The Gandhi AI does have an uncharacteristically large chance of "randomly" spawning with the agenda that makes him revere nuclear weapons, as a throwback to Civ 1.
I have had Civ 6 Gandhi declare war on me, but only extremely early in the game. Which suggests that, as the Kotaku article indicates, he'll only do so if he won't be warmongering.
I'm in the middle of a game of Civ VI right now. Gandhi will not stay happy with me and he keeps declaring war on me every 40 turns or so. But I just took his capital so let's see if we can get him to knock it off.