That Jehu's line lost its throne because of the massacre at Jezreel is quite clear in Hosea's prophecy:
Hosea 1
4 And the Lord said to him, “Name him Jezreel, for in a little while I
will punish the house of Jehu for the blood of Jezreel, and I will put
an end to the kingdom of the house of Israel. 5 On that day I will
break the bow of Israel in the Valley of Jezreel.”
This was Hosea's first prophecy. Not only would God take the kingdom from Jehu's descendants, but Jezreel itself is to be place of a decisive battle. How, then, are we too account for God's seeming approval of Jehu's treatment of the house of Ahab in 2 Kings 10:30:
Because you have done well what is right in my eyes, and have done to
the house of Ahab all that was in my heart, your sons to the fourth
generation shall sit upon the throne of Israel.
The answer may lie in the difference between Elisha's intended instruction to Ahab and the instructions actually delivered to Jehu by Elisha's assistant. In 1 Kings 9 Elisha tells his assistant:
look for Jehu, son of Jehoshaphat, son of Nimshi. Enter and take him
away from his companions and bring him into an inner chamber. 3 From
the flask you have, pour oil on his head, and say, ‘Thus says the
Lord: I anoint you king over Israel.’ Then open the door and flee
without delay.”
Elisha's instructions echo those given by God to Samuel when he anointed David to be king during Saul's reign. The death of Saul and Jonathan would not be done by David, but by the Philistines. There may be a hint as to what God intended in Elijah's prophecy of 1 Kings 19:17 "Anyone who escapes the sword of Hazael, Jehu will kill." Although David was already anointed, Saul remained king until he was killed by the Philistines. Elisha's assistant, however, went well beyond merely anointing Jehu and declaring him king:
6 The prophet’s aide poured
the oil on his head and said, “Thus says the Lord, the God of Israel:
I anoint you king over the people of the Lord, over Israel. 7 You
shall destroy the house of Ahab your master; thus will I avenge the
blood of my servants the prophets, and the blood of all the other
servants of the Lord shed by Jezebel. 8 The whole house of Ahab shall
perish.
The question then becomes whether, based on Elisha's aide's exceeding the prophet's instructions, Jehu not only did "all that was in God's heart" toward Ahab's house, but went far beyond this by his actions in and around Jezreel. I think the answer to this question is yes. God certainly wanted Jehu to become king. But when Elisha's aide told him to carry out a mass slaughter as an act of vengeance, this went too far. As a result, Jehu killed all of sons and many grandsons of Ahab, and also murdered Ahab's wife, Jezebel. In the process, he also ordered the deaths of King Ahaziah of Judah (2 Kings 9:27) and his relatives (2 Kings 10:13). Yet Ezekiel 18:20 teaches: "Only the one who sins shall die. The son shall not be charged with the guilt of his father." Jehu had to pay the price for this violation of God's law several generations later, when his dynasty was destroyed.
Conclusion: Yes, the killing of Ahaziah and his people was one of the reasons Jehu was punished. But he also went farther than he should have in destroying Ahab's entire extended family, which was not what Elisha had instructed. Exactly how far God intended him to go in this is clouded by the fact that Elisha's aide conveyed a different message to Jehu than Elisha had instructed. It is possible that Jehu should have followed the example of the future King David when he was anointed by Samuel during the reign of Saul. God dealt with Saul in His own time, but Jehu took matters into his own hands and - unlike David - committed regicide. Although God approved of bringing an end to the rule of Ahab's house, Jehu's dynasty could not survive long on the foundation of regicide and mass murder.
Addendum: It should be noted that the killing of Ahaziah of Judah and his kinsmen had extremely negative implications for Judah as well as Israel: He was the son of Athaliah, the daughter of Ahab and Jezebel, who had married the king of Judah (the names here get very confusing because both Israel and Judah had kings named Jehoram/Joram and Ahaziah during this period). After Jehu killed her her son, as well as her mother and several other relatives, 2 Kings 11 reports:
1 When Athaliah, the mother of Ahaziah, saw that her son was dead, she
began to kill off the whole royal family... Athaliah ruled as queen
over the land.
Her reign was marked by a revival of Ba'al worship and - six years later - a bloody coup against her orchestrated by the high priest of YHWH.