Running a contest in a given jurisdiction is a form of doing business in that jurisdiction, and so of course the contest is subject to whatever regulations that jurisdiction applies to that activity (contests, in this case). Imagine if this were not the case, and anybody could avoid complying with local laws just by calling their activity a 'contest' and running it out of some foreign jurisdiction.
So, by saying people in Quebec can't play, Google is not required to abide the unusual laws that they have there around contests and lotteries.
This is not true. Contests must abide by any local laws or regulations in any jurisdiction they're run in. If you don't run the contest in Quebec (e.g. if you disallow Quebecois entrants) then and only then are you exempt from their laws.
Google are subject to Quebec's laws because they have offices there and a Canadian subsidiary. If these things weren't, they wouldn't have to abide by such laws. Even if Quebec said they had to, they wouldn't have jurisdiction.
This is not particularly new. What is new is the general belief I've seen in many people that "but I did it on the internet!" is a magical answer.
I seem to remember there are certain laws the British government thinks applies to foreign companies that have no ties to the UK but otherwise do business with British residents, but in the same breath says they have no way to enforce them.
Just as if you sell something to someone from Belgium over the internet, both your and their law applies.
Consumer could sue in Belgian courts but the matter of jurisdiction would arise and that's where the claim would fail.
But in Google Summer of Code case, if it's treated as 'work for hire' then the host country definitely has jurisdiction as the actual work happens there. And Google has subsidiaries worldwide (used for ad sales), so they can easily be targeted.
Basically any contest from outside Canada won't give a damn about working all of those rules in (if it's even possible at all), so they are simply banned from essentially all international competitions of this kind :)