Not a Cube, but a Merida eOne-Sixty. I just cleaned the threads and added a smear of Loctite Blue. No more problems. I have removed the rear wheel many times since then without difficulty and still it does not come loose during use.
The rear thru axle will not come loose if the threads are clean and smeared with a little grease......and the correct torque applied.....usually c 15nm ...which is more than you can comfortably apply with a standard sized Allen key or some ( cheap) multitools. If the above is done and it still comes loose the threads have been damaged and the best solution is a new thru axle. Loctite may provide a temporary solution but once disturbed it is no longer acting as a thread lock.