They are actually from the same origin 以 A 為 B in Classical Chinese. The basic meaning is take A as B.
以 was originally a verb, with lexical meaning of to use. 為 was originally, and still is, a verb, with lexical meaning of to do, make. When two verbs are used together, sometimes one of them gets grammaticalized. 以 and 為 especially have such a tendency, which is widely true for their counterparts in the Sino-Tibetan family. 以 or 為 is grammaticalized as a coverb (converb), used like a preposition in English.
The 以 A 為 B structure is used so much that it underwent different stages of grammaticalization and resulted in different synchronous uses.
- 以 A 為 B:①用 A 作為 B → ②把A當作B
以 is grammaticalized.
①用 A 作為 B, use A to do/act/make B
必以長安君為質,兵乃出。 (西漢)《戰國策》
至丹以荊卿為計,始速禍焉。 (北宋)《六國論》
②把A當作B, take A as B
以銅為鏡,可以正衣冠。 (後晉)《舊唐書》
This usage is not so grammaticalized: in the above example, you can also interpret it as meaning ①.
In modern Chinese, this usage is kept mainly in idioms, like
以和為貴 origin: 《論語》禮之用,和為貴。
以仁為本 《司馬法》
- 以為 B: A is omitted.
以 is taken as a coverb taking and 為 as the verb predicate to be/do.
虎見之,龐然大物也,以為神。 (唐)《柳河東集》 namely 以之為神, this 之, as well as the one in 虎見之, refers to the donkey, which is obvious from the context (not quoted here).
This structure has given rise to another verb meaning of 以, which is consider (as). As follows.
- 以為 B: A is omitted.
以 is taken as the verb predicate think/consider and 為 as a coverb as.
以為妙絕。(清)《口技》
This usage is relatively uncommon and sometimes hard to distinguish from Use 2. But it's corroborated by the verb usage of 以 (think) without 為. It's the same meaning
我以日始出。 (周)《列子》
- 以為 lexicalized as a disyllabic verb
This is often indistinguishable from Use 3. In the above example, it's especially so since the writing is composed in 清 dynasty.
When 以為 was originally used as a disyllabic verb, it was simply take/consider as, and didn't has the meaning of mistakenly think. Now in Modern Chinese, sometimes the mistakenly meaning is there, and sometimes it express uncertain modality.
It's even not that lexicalized. The native intuition of the disyllabic verb 以為 is still 以之為……, i.e. 以A為B. For example, 我以為我錯了。If you ask a native speaker to explain every word, (s)he would say I take it/the fact to be that I'm wrong. This naturally implies that I take it/the fact to be that I'm wrong but it might not be the case. Therefore either a mistake is involved or I'm simply not sure.