It seems that there may be a very simple answer to your question. If we look at 2 Sam 24:1 and compare with 1Chron 21:1, it is easy to see the discrepancy.
2 Sam. 24:1 And again the anger of the LORD was kindled against Israel, and he moved David against them to say, Go, number Israel and Judah.
1Chron 21:1 And Satan stood up against Israel, and moved David to number Israel.
2 And David said to Joab and to the princes of the people: ‘Go, number Israel from Beersheba even to Dan; and bring me word, that I may know the sum of them.’
If you have a King James Bible, the margin will show "satan" where it says "he" in the 2 Samuel scripture. As your question intimates, it seems out of character for God to incite David to sin, then punish the people of Israel. The account in 1 Chronicles makes more sense that it would be Satan to tempt David to sin, so we believe that this account is the more accurate.