UPDATE The question was edited to add the idea that in places without a "religious exemption" is there a heter to purchase from a shul.
Before one can discuss that, one would need to determine that the shul involved is indeed violating the law both as written and as practiced in that jurisdiction. While this would seem to be a "dina d'malchusa dina" and a "Chillul Hashem" issue, One would first need to answer questions that would determine if the question applies. As a result, one first must determine that there is indeed no "religious exemption" for any religion and what the practice is for other religions. Then one can see if this is a "religious persecution" situation or not.
The answer for that situation is that usually there would be a discussion which would involve the "sacramental wine" used by the Catholic Church in its religious rituals. These laws would seem to be written in such a way as to include the synagogue.
Since the question involves specific locations (such as Quebec) , the answer would be to ask the rav of a specific shul that seems to sell wine exactly what the situation is (and what are the applicable laws) in that location.
I have come across locations in which the shul is (as an example) allowed to stock wine bought at the "State Store" for repurchase of its congregants (as a service to those congregants).
As I said each location is different and would have to be looked into. One cannot give a general answer because each case can be different.
Also note the citation below in which the defacto behavior of the locality has "always been" to assume a "religious exemption" exists and the courts have accepted this even if a specific exemption was not written into the law. If this was done in practice, then it is best to keep quiet and not bring the subject up. After all, if it becomes known, it could cause a fuss and "the Jews" would be blamed both for "evading the law" and for removing the "religious exemption" that the non-Jews have "always" enjoyed.
When I visited Pittsburgh Pennsylvania, there was a religious exemption for sale of wine for "sacramental purposes" as long as the store was connected to a synagogue or church.
Thanks to @MonicaCellio for the reference to SACRAMENTAL WINE LICENSEES
§ 11.82. Sale and delivery.
(a) Sales of sacramental wine may be made only to an ordained
priest, clergyman or rabbi in charge of a congregation, for use in the
cathedral, church, synagogue or temple.
(b) Sales of sacramental wine may be made only to an ordained
priest, clergyman or rabbi in charge of a congregation, for the uses
of sustaining members of the congregation or members of the faith who
attend religious services where religious rites require the use of
sacramental wine in the home.
(c) The priest, clergyman or rabbi purchasing the wine shall furnish
to the licensee the name and address of the member or family and the
quantity of wine to be delivered. A sale or delivery may not occur
until the names and addresses have been certified to the licensee.
(d) The sales are limited to 40 liters annually per family.
(e) Deliveries shall be made by the licensee, directly to the home
address, as certified by the purchasing priest, clergyman or rabbi.
The provisions of this § 11.82 adopted October 10, 1952; amended
September 29, 1978, effective September 30, 1978, 8 Pa.B. 2689.
Immediately preceding text appears at serial page (4213).
Alcohol laws of the United States discusses exemptions for underage drinking for religious purposes.
Religion and Prohibition
During Prohibition there were exemptions for sacramental wine and
other religious uses of alcohol. The Eighteenth Amendment, which took
effect in 1920, doesn't say anything about those exemptions. It just
says that the manufacture, sale or transportation of intoxicating
liquors within the United States is banned. It was federal legislation
that exempted religious uses from the laws.