In fact, we cannot be certain that Job even knew the true identity of Satan! So he wrongly assumed that his problems were caused by God.
نَعَمْ ،‏ مِنَ ٱلسَّهْلِ أَنْ نَخْلُصَ إِلَى ٱسْتِنْتَاجَاتٍ خَاطِئَةٍ حِينَ لَا نَكُونُ عَلَى عِلْمٍ بِكُلِّ ٱلْوَقَائِعِ .‏