It just seems like such an odd reversal. The king and his mother had clearly been putting a fair amount of effort into making peace with protestant leaders, what with marrying Margaret to Henry of Navarre, and Charles IX's attempts to pacify Coligny.
So why did the king and company suddenly change their minds and decide to have a bunch of people killed? Having just brokered a peace a few years back, it seems like the last thing they'd wanna do is further antagonize the protestants, surely?
You are right to see that there is something odd in Charles IX's decision to have the Huguenot leaders killed.
The first attempt to kill Coligny ( the one that only wounded him, on the 22nd of August ) is more than likely not on the hands of the King, Catherine de Medicis or the crown but instead a plot from the Ultra Catholics or the Spanish. After the assassination attempt on Coligny, rumours spread ( were they true or spread by the Ultra ? That is unknown ) that the Huguenots were planning to take revenge by assassinating someone close to the power and/or the Ultra. Maybe the King, maybe Catherine.
Add to this that the Parisian population, mostly Catholic, was extremely tensed, scared and furious against the Huguenots but also against the King. This explains the scale of the population's participation in the Saint Bartholomew Massacre. The power and Charles' plan was to actually ease the tensions by decapitating the Huguenot party. By killing the leaders ( they were nobles, often from great families ) the Huguenot would ten become less of a threat. The principle targets were the " Huguenots of war ", those who taken part during the Wars of Religions and threatened to take arms again. The plan was to take out only a few ( dozens ) of them maybe.
As we know, it did not go as planned because some Huguenot aristocrats escaped like the Duke of Sully or Duplessis-Mornay. To that the Parisian militia refused to re-open the door and the massacre that we known of happened.
So you are right to say that antagonizing the Huguenots was the last thing they'd want to do. It was not at all the plan but the role of Charles IX in the massacre in overshadowed by his following actions.
After several days of blood bath in Paris, The King came to the Parliament of Paris on the 25th of August and took the blame for everything that had happen. Everything. This is not helping our understanding of his actions but the decision to accept responsibility was well thought. Several well known authors, whose writings are an extremely important testimony on the period, have praised Charles IX and Catherine for the elimination of the Huguenots leaders. The most important of them being Claude Haton and his mémoires, an Ultra Catholic who saw the events as divine justice. I will quote myself from a post I made here on the subject of the Saint-Bartholomew and the position of the King:
On the 25th of August, Charles came to the Parliament of Paris and declared that he was fully responsible for everything that had happened. The assassinations but also the massacre of the Huguenots. This is important for what happened in the provinces. If the King asked for the peace to be kept the fact that he accepted the responsibility pushed many to think that attacking the Huguenots was the right thing to do. Why did Charles took the blame while he, after all, never asked for all the Huguenots to be butchered ( I think this word is adequate )? Two possible reasons. The first is purely political, it would help to ease some tensions if the King did it. It was not the Guise, not X or Y but the King who is above all. The second reason is also political but concerns the person of the King itself. If it was not him then the massacre happened without his green light and his knowledge. But the King is supposed to be omnipotent, to have the role of God on Earth ( Lieutenant of God/Lieutenant de Dieu, the proper meaning being Tenant Lieu de Dieu : Acting as God on Earth ). This happened at the time when the monarchomacs ( influential in the Huguenot sphere but also among Ultra Catholics ) appeared in France and England, justifying tyrannicides. Philippe Duplessis-Mornay who escaped death during the Saint-Bartholomew massacre, was one of them for example. Should the King be no longer sacred, then there is nothing to fear from God if you murder the " tyrant ". This is what happened to Henri III, assassinated by the Dominican Jacques Clément. Charles IX was forced to take responsibility for the sake of the king's person.
We also have to keep in mind that the political situation of the Kingdom of France was changing. The crown tried, as you said, to ease the tensions and work several peaces with the Huguenots. However, the threat also came from the Ultra Catholics lead by the Guise ( think of the crown as the moderates ) who would not accept a peace with the Huguenots. This placed the crown in an extremely difficult and dangerous position as the three groups will not be able to live together. The assassination attempt on Coligny quickly changed the game and the situation, the Huguenots were not going to let this pass without some form of retaliation and the decision to weaken them by killing the leaders was taken very fast indeed, in one night.
Sources
La France du XVIème siècle : 1483-1598 by Arlette Jouanna
La Saint-Barthélémy : Les Mystères d'un Crime d'Etat (24 août 1572) by Arlette Jouanna
Les guerriers de Dieu : La violence au temps des troubles de religion (vers 1525- vers 1610) by Denis Crouzet