They should probably still accept the reality of the punishment, at least until the law is modified. Disobeying a law for moral reasons is only the first half of civil disobedience.
It costs the government money to put people in prison; not only the cost of their food, shelter, supervision, etc. but also the cost of removing a taxpayer from the workforce. Furthermore, a democratically elected government that is increasingly imprisoning more and more of its people is not likely to remain popular. It is in the government's best interest to only enforce laws that the majority of people are happy to obey.
Civil disobedience is a technique that protesters who think a law is unjust use to take advantage of this interest. By deliberately disobeying the unjust law and accepting the punishment for it, they help put pressure on legislators to change it. The government prefers a situation in which no laws are ever broken--that's why it makes such an extensive effort to incentivize citizens not to break them--but in the case where enough people feel it is in their best interest to break the law even with the punishment that comes with doing so, as people who use civil disobedience do, then the law must change if it is to reflect the will of the people.
The example you gave re: homosexuals/death penalty is extreme, but follows the same principles, as long as that government is democratically elected. Most democracies don't get to the point where they're throwing the death penalty around willy-nilly though, thank God.
It isn't the majority of all people that matters, just the most consistent individual groups of voters. And felons can't vote. How do you disenfranchise and silence entire communities of people? Disproportionately charge them with felonies. It's obviously broken.
Civil disobedience makes sitting ducks of powerless people. Idealism doesn't change laws, or political culture, or us-vs-them mentalities, or nepotism, or corruption, or revolving doors. Law makers change laws, and not easily. Occupy changed what exactly? Maybe it influenced the adoption of Cop Cams a little, but it had little effect on banking practices, and that system affects pretty much everyone.
Change isn't hopeless, but it doesn't work the way you'd hope it would.
If you were in power, and you feared civil unrest, it would be in your best interest to establish civil disobedience as the most severe form of legitimate protest. The idea that dissidents should not use violence but should instead submit themselves to arrest is very convenient for those who already have power.
In public schools across America, civil rights activists who advocated non-violent civil disobedience are lionized, while civil rights activists who advocated for techniques that did not involve martyrdom are either ignored or vilified. The first are given credit for the relative success of the civil rights movement, while the role of the later is severely downplayed. I do not believe that this is an accident.
Except when being used as a talking point to stir a base, they do not care. If anything, their budgeting practice of use it or lose it creates a desire to spend as much as they can.
And as the other commenters have pointed out, it is very very beneficial for the most virtuous form of protest to be 'break the law and accept punishment'.