Don’t forget-- Solomon was actually a younger son of David’s than Adonijah was. (Solomon’s mother was Bathsheba; Adonijah’s mother was Haggith.) So because Adonijah was an elder son, it was presumed that he would be ahead of Solomon in line for the throne, but Bathsheba and the prophet Nathan both convinced David to declare Solomon his heir instead.
Also don’t forget who Abishag the Shunammite was: she was basically King David’s hot water bottle.

She would snuggle up with him in bed to keep him warm in his old age. Even though Kings says that “he knew her not”, and she neither married him nor had any relations with him, sleeping with the King’s concubines was one way of declaring yourself king. (Remember older brother Absalom?)
So here you have a guy who, in ch 1, declared himself King when his father was dying, but Solomon was crowned instead. All that gets forgiven and put in the past, even though it must have been tremendously humiliating, but Solomon was very magnanimous and said that as long as he shows himself worthy, he’ll live, but if he shows himself evil, he’ll die next time. So what does he do in ch 2, but try to pull this stunt? Whether it was innocent or part of a scheme, it doesn’t matter— it was a Really Bad Idea, and his lack of prudence and judgment caused things to end badly for him.