Preface: Please forgive me for writing in English; I do not speak German (yet!).
ersatz (adj.) [:] 1875, from German Ersatz “units of the army reserve,” literally “compensation, replacement, substitute,” from ersetzen “to replace,”
from Old High German irsezzen, from ir-, unaccented variant of ur- (see ur-)
+ setzen “to set” (see set (v.)). As a noun, from 1892.
ur- [:] prefix meaning “original, earliest, primitive,” from German ur- out of, original,
from Proto-Germanic *uz- “out,” from PIE *ud- “up, out” (see out (adv.)) […]
How did the bolded morphemes combine to mean to replace in ersetzen?
The meaning of the prefix ur- as out of, original seems to contradict the meaning of to replace, because something out of (a predecessor), original implies a sense of firstness that a replacement lacks. Please expose and explain the hidden, missing semantic drifts and links.