
Simi_Tutu:
the crown prince behaved as though he doubted his legitimacy as the rightful heir to the throne
I'm not too well-versed in actual Chinese history, so someone who knows more about that might be able to provide a more accurate response, but this is my take based on the Historical cdramas that I've seen.
Basically, the crown prince position is not a birthright to the firstborn son. Though yes, the son of the empress is most likely to become the crown prince, it is not a guarantee that he will become the emperor, since the emperor is ultimately the one who decides that. Basically, all legitimate sons of the emperor have a claim to the throne.
Usually, the empress's first son is the crown prince because he's usually the first son of the emperor, was trained specifically for that, and typically has the backing of his mother's family since they're the reason she became empress in the first place. But still, that's not a guarantee for him to keep his position as crown prince. I'm watching a drama where the crown prince has all of that, is the first son, son of the empress, has the backing of her family which is very powerful, and still is fighting tooth-and-nail to keep his position, exclusively for the fact that the emperor does not like his maternal family and, by extension, the empress and even his own son.
In another drama, the crown prince is constantly duking it out with his younger brother for the same reason. Despite already being the crown prince. The emperor allows his sons to compete to figure out who truly is the one who should become the next emperor. It doesn't help that in this drama, once again, the emperor is at odds with his empress...
I'm not sure if it would be considered treason to try and kill the crown prince, but overthrowing him and becoming the heir definitely wouldn't be, since the only way that would be possible is if the emperor allows it (willingly or not). I'm inclined to say no about the former, because chances are it would be handled internally, and the emperor wouldn't kill his own son even for attempted fratricide. Attempting to assassinate the imperial family is treason, but I'm not sure about what the stance is on that when it's another family member doing the assassination.
This might also depend on the dynasty the story takes place.