An avatar does not restore the ideal dharma, because there is no ideal dharma. An avatar redefines dharma for a particular age. Dharma of Krita yuga is not the dharma of Treta yuga; times are different, needs are different, hence the code of civilisation is different.