Even though it was at least 11 years after David took Bathsheba, Nathan’s words of God’s judgement would have had to have been in David’s mind as he fled Jerusalem:
2 Samuel 12:11-12 This is what the Lord says: Because of what you have done, I will cause your own household to rebel against you. I will give your wives to another man before your very eyes, and he will go to bed with them in public view. You did it secretly, but I will make this happen to you openly in the sight of all Israel.
As he fled, David refused the priests’ offer to leave Jerusalem with him:
15:25-26 Then the king instructed Zadok to take the Ark of God back into the city. ‘If the Lord sees fit’, David said, ‘he will bring me back to see the Ark and the Tabernacle again. But if he is through with me, then let him do what seems best to him.’
As Shimei cursed David, throwing insults, stones and dirt at him, his words were perhaps more stinging than they otherwise would have been:
15:7-8 Get out of here, you murderer, you scoundrel! … The Lord is paying you back for all the bloodshed in Saul’s clan. You stole his throne, and now the Lord has given it to your son Absalom. At last you will taste some of your own medicine, for you are a murderer!
David had murdered Uriah the Hittite, and he knew it. It might explain why David was unwilling to take action against Shimei:
15:11-12 … My own son is trying to kill me. Doesn’t this relative of Saul have even more reason to do so? Leave him alone and let him curse, for the Lord has told him to do it. And perhaps the Lord will see that I am being wronged and will bless me because of these curses today.
We’re not told what David’s response was when Absalom took David’s concubines, in what was a very literal fulfillment of Nathan’s judgement, but Ahithophel’s advice to do that was possibly based on his knowledge of the affair. Having Absalom act in that way might have been aimed at not only enraging David (as stated) but also to dispirit David and his troops through an overwhelming display of the intent of God as Ahithophel tried to present it.
Now David was willing to fight for his own life, why would he flee otherwise? But he wasn’t willing to fight God for the throne. This appears to be a real difference between him and Saul.