自以为是 is a chengyu derived from ancient Chinese literature. There is a very important thing you should bear in mind when learning chengyu, that is, in old Chinese, monosyllabic words are much more common than bisyllabic words. Normally you shouldn't try to interpret the structure of chengyu by morden Chinese grammar rules. 以为 is a bisyllabic compound word in morden Chinese, but it's not in old Chinese, at least not in 自以为是. Instead, 以 and 为 are two separate monosyllabic words. 自以为是 is a inverted sentence. The "nomral" order is 以自为是. It's made up of four monosyllabic words. 以 means think, 自 means oneself, 为 means be, 是 means right. This will be very obvious if you read @Pedroski's example carefully:
《荀子·荣辱》:“凡斗者必自以为是,而以人为非也。”
The whole sentence means: Those who fight will always think that they themself are right and others wrong.
Now comapre the word order of 自以为是 and 以人为非.
自 以 为 是
oneself think be right
以 人 为 非
think others be wrong
Obviously, the meanings of 自以为是 and 以人为非 in 凡斗者必自以为是,而以人为非也
are related to each other and it's easy the reason that the structure of these two 4-character phrases should be symmetric, and the syntatical functions of the corresponding characters in the two phrase should be the same. Now it's easy to get the conclusion that 自以为是 is actually 以自为是.
Then what's the reason for this inverted order? In fact, this is a very common structure in old Chinese. If the object is 自, it can sometimes be put before the verb for emphasis. Other examples are 情不自禁,不能自已,作茧自缚,扪心自问 and so on.
There is a chengyu 自欺欺人, which means to deceive oneself as well as others. You can compare 自欺 and 欺人 with 自以为是 and 以人为非.