The long and short of it is regionalization. Duverger's Law only works on the national level when political parties are well co-ordinated at the national level. Otherwise, and in particular where parties can gain a regional footing, there are easily exceptions. Let's take some of the examples you mentioned, starting with India.
India's politics is an extremely strong case study of regionalization. The two largest parties in India's Lok Sabha (lower house) right now, the Bharatiya Janata Party and the Indian National Congress, account combined for not even 60% of the MPs. The BJP is able to obtain majority power by coalitioning with a variety of regional parties, bolstering its 269 MPs to a governing force of 341. The fact that some of these regional parties only hold one or two seats yet are welcomed to the governing coalition anyway is evidence of the fact that these ideological alignments are natural, even if the MPs come from different regional parties.
The United Kingdom is a slightly easier example to explain. Not counting Change UK (which formed amongst already-elected members of Parliament from Conservatives and Labour), there are eight political parties with representation in Parliament: the Conservatives, Labour, the Scottish Nationalists, the Democratic Unionists, the Liberal Democrats, Plaid Cymru, the Greens, and Sinn Fein. The reason Duverger's Law hasn't totally applied to the United Kingdom is because of regionalization. The DUP and Sinn Fein combine for all of Northern Ireland's representation and is the most obvious example. In Wales, Plaid Cymru has been able to gain seats as a result of Labour's overall dominance in the region vis-a-vis the Conservatives (leading Plaid Cymru as a left-wing party to be a palatable alternative), as well as a prevailing Welsh nationalist sentiment. The Liberal Democrats continuing to be quasi-politically relevant, somewhat an exception that proves the rule, is a carryover from when the Liberal Party was the second party in a two-party system with the Tories back before the advent of Labour, but they've lost the vast majority of their political clout with the advent of the SNP since much of their support was concentrated in Scotland. In turn, the SNP have risen to power because of their politics being exactly what they say on the tin: Scottish nationalism. They're the quintessential regional party that has capitalized on that regionalism to earn a hefty seat percentage. And then there's the Greens, a case study of what happens when a charismatic leader is also an MP. (See, for comparison, Bernie Sanders in the United States.)
Canada is a tougher nut to crack but in general this same principal of regionalism applies. The Bloc Quebecois is perhaps the most obvious example; its members obviously only run in Quebec, and they win in Quebec from time to time. However, the NDP seems to be an outlier to Duverger's Law... except just as the Lib Dems thrived off of regional support, for the NDP, Quebec giveth and Quebec taketh away. And then, again, there's the Greens.
To reiterate, then, Duverger's Law fails to take into account regional interests causing different party landscapes at a regional level, each of which is independently stable.