If the rear nut loosens by itself repeatedly after retensioning it, likely the thread of the nut is damaged. And/or the thread on the axle, although the axle thread is typically stronger than the nut material, on purpose, because an axle is alot more expensive than a nut.
Even the frame dropout alu could be fretted out due to numerous retensionings, which is harder to solve.
I had such situation on a previous bike, and I could solve it along a longer axle with more thread on it, to allow a couple washers-spring ring, the spring ring at the side of the frame, the washers (flat) at the side of the nut, so the nut could be tensioned without fretting in the dropout.
Lube the spring ring well to avoid corrosion and subsequent breakdown