This is a good place to reflect on the difference between Biblical principles and Biblical absolutes. It seems to me that David had his dynasty guaranteed. Consider the following words to David regarding his son Solomon,
(1 Chronicles 17:12 KJV) He shall build me an house, and I will stablish his throne for ever.If taken in isolation this seems like an absolute promise. Yet even Solomon understood that there were conditions and offers this as a qualifier.
We see a similar thought later:
(Pro 29:14 NAS77) If a king judges the poor with truth, His throne will be established forever.Notice the "if." Always consider the “if’s” of life.
So? God’s promises are true. So are His expectations and conditions. Don’t try to bind Him with your conditions, live by His.