Imagine
ATC has cleared you to maintain
Flight Level 120, and another aircraft is assigned
Flight Level 120 from below but has not reached it yet. On radar,
ATC is tracking both aircraft, but there is a processing delay or a radar blind spot. TCAS, with its own radar, detects the conflict in real time and commands you to climb. You do so.
ATC will see your altitude change on radar, call you, and you explain the RA. This is not a violation; it is safety protocol.