As linked to by user77834, Larousse gives only a very brief note on the etymology of attacher and détacher
(translated):
The Germanic stem found here is discussed briefly in Guus Kroonen’s _Etymological Dictionary of Proto-GermanicEtymological Dictionary of Proto-Germanic, which is unfortunately quite new and still not available online. Most of the discussion relates to the Proto-Indo-European origins of the Proto-Germanic form, which is not relevant here, so I’ll just cite the attested forms:
The fact that there are two variants in the Romance languages, one with initial tac- (corresponding to Old French [tak-]) and one with tach- (Old French [tatʃ-]) is interesting: it makes it likely that the word was borrowed towards the end of the period in which the sound change known as the Gallo-Romance Palatalisation (the second wave of palatalisations to affect the French language) was productive. During this period, /k/ and /ɡ/ were palatalised to /tʃ/ and /ʤ/ before the vowel /a/. It seems like that the word was borrowed at a time when some dialects still automatically palatalised /k/ as in *takka-, phonemically /takːa/, to /tʃ/, yielding /tatʃːa/ (which is completely identical with Italian taccia); but others had stopped doing so and could borrow /takːa/ as-is without any change necessary. Both variants apparently gained currency in French and spread to Italian, Spanish, Portuguese, Occitan, Provençal, and after sprouting a hostcouple of other minorderived verbs with a- and de(s)- as preverbs, they both started spreading to the neighbouring Romance languages. As a loan word that varied quite a bit both in meaning and form, it is perhaps not too unexpected that both masculine and feminine forms (as well as augmentatives in -on(e)) cropped up.
In the derived verbverbs, the basic sense of ‘nail’ seems to have been somewhat less liable to be broadened: apart from the evolution to ‘attack’, all the verbal forms in all the Romance languages meanare basically ‘attach’ and ‘detach’—tosemantically derived straight from the base meaning: they mean to nail something to something else, or to remove the nail from something else, as it were. Attaching and detaching. The further secondary meanings ofto do with heels, patches, and stains, etc., are not found in the verbal derivations.
As I said above, estachier undoubtedly did exist; but so did atachierattachier, if we are to believe Etymonline, who says that while estachier is earlier, attachier is attested from the 11th century. (Sadly, this is not one of those cases where Etymonline is getting their information from the OED; I cannot seedon’t know where they get thethese dates from.)
In this particular case, estachier would be the latter: it meant originally ‘stake’, i.e., ‘drive in a stake’, but later on just ‘add to’ or ‘attach’. A(t)tachierAttachier would have meant almost the exact same thing. Essentially, there were two very similar words that meant almost the same thing. One had a very clear and unambiguous preverb a- ‘into’ that fit the meaning of the verb very well; the other had no preverb, but could be understood as having a preverb e(s)- ‘out of’ that meant the exact opposite of what you’d expect, given the meaning of the word. A situation not unlike inflammable, which means the opposite of what it looks like it’s supposed to mean at first blush if you’re not familiar with its etymology. And then there was destachier, which meant what estachier looked like it was supposed to mean, but also had a very clear and logical preverb de(s)- ‘away from’.
1 Later on, at some stage of Late Latin or Common Romance, the final /d/ in the standalone preposition ad was lost, and the preposition was thenceforth just a (written à in Modern French). At that point, then, the original /d/ only showed up as an actual /d/ in old verbs where the base verb began with a vowel, like adorn (from Latin ad- + ornāre ‘make ornate, deck’): in all other contexts, the /d/ had been either lost entirely or assimilated to the following consonant. From that point on, it doesn’t really make sense to say that the preverb was ad- anymore. Old French even started treating it completely like it was just a-: many of the historically geminate consonants, especially t’s, were simplified, so the Old French descendant of Latin attingere was most commonly spelt ateindre, notrather than atteindre. There was quite a bit of variation, though, and doubled consonants were not uncommon, either; for the sake of simplicity, I consistently write geminates where they are etymologically or systematically to be expected, so while atachier and ataquer are more frequent spellings in actual Old French texts, I write them as attachier and attaquer here. Much later on, though, when French orthography started becoming standardised, they decided to approach the Latin origins of many words, and they reintroduced the geminates.