This is a difficult question! In fact, two difficult questions. I'm just going to tackle the second one, and leave aside how we should think about political obligation.
In the end, I think the answer is that legitimacy and civil disobedience are compatible. But it's going to take a while to get there. I’ll start with a working definition of civil disobedience, taken from perhaps the most influential political philosopher of the 20th century, John Rawls. He says civil disobedience is ‘a public, non-violent, conscientious yet political act contrary to law usually done with the aim of bringing about a change in the law or policies of the government’ (A Theory of Justice, p. 363). A couple of brief comments on this definition that will help us answer your question. If you don't agree with these, then you won't agree with where I end up.
1. Civil disobedience always involves doing something illegal. However, in most democratic countries, such as the US, civil disobedience is not itself a crime. If arrested and prosecuted, protestors are charged with breaking whatever law was broken by the act of civil disobedience (blocking a public highway, trespassing, etc.).
2. Ordinary violations of the law do not have the aim of changing the law or demonstrate opposition to a government policy. They do not seek to make a statement or communicate a message to society. People break the law for many reasons, apart from the usual ones of greed, self-interest and emotion that motivate criminals. For instance, they may break the speed limit without thinking they are doing anything particularly wrong, because they feel there is no strong moral reason to obey the speed limit. Or they may break the law because it conflicts with a personal moral conviction. This may be because they rank some other moral duty, e.g. to protect a friend, higher than the duty to obey the law; or it can be a case of ‘conscientious objection’. However, civil disobedience always aims to change some law or policy.
3. Civil disobedience aims to communicate to society the protestors’ condemnation of the law and their desire for the law to be changed. This message can only be communicated if the act of civil disobedience is announced. The public nature of civil disobedience also relates to the protestors showing that they respect and submit to the law. By allowing themselves to be identified and arrested, they show that by breaking the law, they are nevertheless not seeking to undermine the law.
On this understanding of civil disobedience, is it justified in the USA? Let’s assume that the state is legitimate, either because it is founded on consent (democracy) or because it is ‘reasonably’ just. In that case, the fact that we are breaking the law itself counts as a reason against civil disobedience if there is political obligation. But it can sometimes be right to break an obligation for the sake of some greater moral value. And so Rawls argues that if the aims of an act of civil disobedience are important enough, then the act can be justified on certain conditions. One of these is that all legal attempts to change the law have failed. Civil disobedience must be a ‘last resort’. Second, civil disobedience must be non-violent. The most important interest that the law protects is our safety. To threaten this is to act unjustifiably, says Rawls, because the aim of civil disobedience cannot be more important than the protection against violence.
For the state to be legimitate, we must have a right to political participation. This must involve expressing our dissent from the laws of the state. But this may not give us a right to civil disobedience. It may only give us the right to legal protest, e.g. if the state is already reasonably just. This only means that civil disobedience must be ‘exceptional’, and so will need to be very sensitive to the individual circumstances of the action we are trying to justify.
Two things to pay attention to will be the consequences of the action of civil disobedience and the motivation for undertaking it. For example, civil disobedience can be divisive, it may encourage disrespect for the law, it could increase political instability. But these effects are mitigated when the protestors are willing to submit to punishment, which makes clear their general respect for the authority of the law, and so will minimise any encouragement of unjustified disobedience or general disrespect for the law. It also indicates the protestors’ strength of feeling and the fact that they are not acting for personal gain. This will diminish the antagonism and resentment that others feel if they disagree with the protestors, and are important for right motivation for the action. It is part of the definition of civil disobedience that it is motivated by a genuine sense of the law being morally wrong. We could also say that the protestors must have given careful thought to the appropriateness of the action. And this depends on a sensitivity to the social and political context. How unjust is the government generally? How unjust is the law? How much protest can society take? These questions cannot be answered in general.
Mill argued that instead of becoming annoyed with people who contest an accepted view, we should be grateful to them. They help open our minds, and they are doing what we should be doing – thinking for ourselves and aiming to get at the truth. We can argue a similar case for justified civil disobedience, that instead of looking at it as an irritant and disruptive to the smooth running of society, it is essential for the political health of the state and therefore a demonstration of good citizenship by the protestors.
None of this shows that the state is ‘ultimately not legitimate’, as you ask. It shows that legitimacy is compatible with civil disobedience. It is quite a 'conservative' answer. But if we can justify civil disobedience if assuming a conservative political position, then we can justify it all the more if we assume a more radical political position.