The UN allows for collective pre-emptive self-defense. Ukraine was preparing to invade the DPR and LPR, which had signed a mutual defense pact with Russia.
Russia therefore came to the aid of its ally to "defensively" pre-empt an invasion by Ukraine. It's just that simple.
Yes, Ukraine did not recognise the independence of the DPR and LPR, but Russia did, and under Article 1 of the UN Charter, people have a "right to self-determination".
The laws that Kiev had passed banning Russian language, culture, history, films, books, etc., the abolition of the Russian Orthodox Church, certainly had robbed the people fo the DRP and LPR of their cultural and societal self-determination.