For me 'righteousness' means right standing with God. Jesus became our righteousness. We may be good but yet not have right standing with God.
I found this in JFB commentary relating to this verse in particular. Maybe this helps:
For scarcely for a righteous man--a man of simply unexceptionable character.
will one--"any one"
die: yet peradventure for a good man--a man who, besides being unexceptionable, is distinguished for goodness, a benefactor to society.
even dare to die--"Scarce an instance occurs of self-sacrifice for one merely upright; though for one who makes himself a blessing to society there may be found an example of such noble surrender of life" (So BENGEL, OLSHAUSEN, THOLUCK, ALFORD, PHILIPPI). (To make the "righteous" and the "good" man here to mean the same person, and the whole sense to be that "though rare, the case may occur, of one making a sacrifice of life for a worthy character" (as CALVIN, BEZA, FRITZSCHE, JOWETT), is extremely flat.)