Remember, I said that I thought the exegesis was a mistake. The function imputed righteousness plays is, as I said, making it clear that we don’t have to (and can’t) earn our place as God’s children. However the reasoning behind it was questionable, in my view. Calvin, and I think Luther, believed that God would only accept moral perfection. Any sin earned us hell. Since we obviously can’t be perfect, he credits us with Christ’s.
I’ve noted before that if you look at how righteousness is used in the Bible, it does not indicate moral perfection, but rather someone who is living as God would have us live, which includes repentance when we fail.
So I think the Reformers were wrong in this reasoning. However Paul really does say that righteousness is imputed to us. The mechanism is a just a bit different. It is imputed to us because of our faith, which for Paul is what connects us with Christ.
But if you look at the broader context of the doctrine for the Reformers, what they were concerned about was practices that served to make people feel that they were constantly on the brink of being rejected by God, and had to do things to make sure they stayed in his good graces. The most notorious example of that was Tetzel, who used the fear of hell to raise money for paying off the construction of St. Peter’s.
The emphasis on imputed righteousness was that we don’t have to earn God’s continuing love and acceptance. Righteousness was imputed to us because we’re Christ’s. As far as I can tell, they were right about the pastoral problem and about the importance of assuring people that God’s acceptance is a gift, which we don’t have to live in fear of losing. I think they were even right in finding it in Paul’s concept that righteousness is imputed to us. I just think there were issues in the way they thought this happened. I believe their problem was a leftover from late medieval ideas of justification.
(None of this, of course, denies Jesus' teaching that we are accountable for how we live.)