A state has legitmacy because that state made laws.... You are trying to justify authority by stating that that authority does something, whether that's good or bad, you realize your argument is circular right?
It is axiomatic but not circular.
All legitimised systems have laws and governance, anarchy may have illegitimate pseudo-laws but the very thing required to legitimise them as concrete laws and to legitimise the anarchy as a legitimate state/nation is a governing body with a legislative branch. In fact the governing body could be unlelected and monarchic, democracy isn't a necessity only a governing body is.
It is axiomatic (self-fulfilling) but it is not circular because the argument does focus on your point about legitimacy and anarchy.
Anarchy cannot be legitimate, it can only be illegitimately temporarily controlled chaos.