That (i.e., "unjoining the domain") doesn't really happen but a machine that
is losing it's authorization typically has a NAME RESOLUTION, usually
DNS problem.
DNS must be DYNAMIC and all internal machines must be configure to
ONLY use that internal, dynamic DNS server (set). This includes DCs
and DNS servers themselves.
Do NOT add an external server in the NIC configuration of any internal
machine.