And what's wrong with taking a census anyway?
I don't believe we are told anywhere that taking a census is wrong, but in Exodus 30, God makes certain commands concerning them:
12 “When you take the census of the people of Israel, then each shall give a ransom for his life to the Lord when you number them, that there be no plague among them when you number them. 13 Each one who is numbered in the census shall give this: half a shekel according to the shekel of the sanctuary (the shekel is twenty gerahs), half a shekel as an offering to the Lord. ESV
And likewise in Numbers 1:
49 “Only the tribe of Levi you shall not list, and you shall not take a census of them among the people of Israel. 50 But appoint the Levites over the tabernacle of the testimony, and over all its furnishings, and over all that belongs to it. They are to carry the tabernacle and all its furnishings, and they shall take care of it and shall camp around the tabernacle. 51 When the tabernacle is to set out, the Levites shall take it down, and when the tabernacle is to be pitched, the Levites shall set it up. And if any outsider comes near, he shall be put to death. 52 The people of Israel shall pitch their tents by their companies, each man in his own camp and each man by his own standard. 53 But the Levites shall camp around the tabernacle of the testimony, so that there may be no wrath on the congregation of the people of Israel. And the Levites shall keep guard over the tabernacle of the testimony.” ESV
It seems reasonable to suppose that David neglected to follow some or all of these commands with his census.
How can we make sense out of this?
The idea that Satan is an independent agent (independent of God that is) is related to the ideas of Dualism and is not well supported in Biblical Texts, and especially alien to the Old Testament.
Satan's incitement of David is one and the same as God's incitement because Satan is under God's complete control and is therefore in a sense an agent of God (albeit an agent of disaster, destruction and judgement rather than directly an agent of grace). A similar logic is found in Job 2 after God has permitted Satan to afflict Job, He takes direct responsibility himself:
3 And the Lord said to Satan, “Have you considered my servant Job, that there is none like him on the earth, a blameless and upright man, who fears God and turns away from evil? He still holds fast his integrity, although you incited me against him to destroy him without reason.” ESV