The law already dictates certain activities that are off-limits, as well as certain groups that are protected. While it is legal to discriminate against people for some reasons, such as not wanting a belligerent drunk staggering around your business, there are some forms of discrimination that are likewise prohibited.
Among the forms of discrimination not allowed are those based on religion, ethnicity, gender (including gender identity), sexual orientation or handicap (people in wheelchairs have just as much right to public restrooms as walking people). If someone does break those laws, then in addition to their legal troubles, they are now eligible to be discriminated against themselves as “being a bigot” is not a status that enjoys legal protections the same way having a uterus is.
”[W]hat about the people who live in a country where the opposite would get them in trouble?”
Historically, that really depends on how the dominated group treats their opposition in the past. For instance, given that slavery is a thing that happened in our nation, the blacks are entitled to certain liberties that whites are barred from. Try holding a White Pride rally somewhere and you’ll draw all sorts of flak that a Black Pride rally would not. Why do we allow that double standard? Slave owners were cruel to their slaves, and now we are obligated to be a little extra nice to the descendants of the slaves as compensation for the sins of our forefathers.
On the other hand, when relations between the two groups are less oppressive, you will find that the double standard ceases to exist. The balance of power has always been close enough to equal that a change in circumstance does not lead to any call for compensation, nor any need for legislation saying, “Hey, that shit ain’t cool no more!”. In such cases, neither side can get away with anything the other cannot as everyone is held to the same standard. Nerds never burnt comic books on the front lawns of geeks, so when society shifted and made being a geek actually cool, nerds didn’t have to worry about being lynched. Since there hasn’t been any real tension between the two groups, there has been no need to give either group legal protections, reparations, special liberties, or anything like that.
In your example involving Atheists, look at the behavior of Christianity in the past and you will see that Christianity has a lot of sins to atone for. And now that the world has changed such that Atheists can come out of the closet without fear of discrimination (and the power to sue those who do discriminate), we are allowing them a few liberties that Christians are not allowed. The double standard that allows Atheists to ridicule religion while prohibiting Christians from replying in kind is the result of many centuries of oppression and persecution.
You are entirely correct to point out and question double standards; I do much a lot of that myself. But sometimes the reason behind a double standard is nothing more than a pendulum reaction to the past. When there has been little disturbance, the pendulum barely moves. Where there have been many disturbances, that pendulum will swing pretty far to one side for a while before swinging far to the other side, and will take a long time to settle down and stop swinging.
With that in mind, think about how our society has treated anyone other than heterosexual white Protestant males in the past and ask yourself if you can’t see quite a few things that would justify some form of backlash that may appear to be a double standard.