This would have been a sin of pride on King David’s part, a statement before God that these people were David’s. The devil wanted David to do it so he would sin. God permitted the devil’s desire to tempt David to show him where he needed to repent.
Does it carry over to representative republics such as the USA. I would say no it does not carry over directly for it depends on motive.
Thanks that was an interesting and thoughtful response...