The Emperor dissolved the harem for Ling Xiao before he gave him any hint he was going to give him weapons. You could say that the weapons settled down the court more than for the Emperor...
the reason why mc was "threatened" was bc the emperor was jealous, bc before that the mc shared a bowl of iced fruit tea or something with one of emperor's concubine->indirect kiss. when the emperor didn't want mc to be in contact with this concubine again, instead of clearing things up (like mc sees this girl as a little sister), mc counterred that why is it that mc has to share the emperor with his concubines and he (mc) can't have more than one lovers-> very big quarrel with death threats (bc we are in ancient china, come on, it's quite common at that time), etc. mc didn't know that the emperor took mc's words to heart and planned to dissolve the harem. mc feared for repercussions (after all, the emperor needs an heir and the dissolving of the harem is against thousand of years of tradition) from the officials and from the citizen, so he decided to help the emperor fix his standing and also to avoid being seen as a burden with his future knowledge of gun powder.
Does the ML love the MC very much? Since he wasn’t willing to throw away the harem, until the MC show him how to make guns. It is just that he knows how to draw a line between personal life and business life (which I don’t really believe, since he was willing to go to war with another country just to get the MC back)? Also another thing confuse me, when the MC escaped with the Prince of another country, did the ML willingly allow the MC to escape, if so why does he try to go to war with the other country later? Never mind just saw the spoilers!