I wonder how it is that the word "congratulations" has become the go to sentiment for a person who has just given birth. In many circumstances it makes sense. When speaking to a member of a first family it is among the most painful and infuriating words in the English language. For more thoughts related to this word and the subtext it can carry, see my ramblings here.
I remember being congratulated by a few people when sharing the news that Athena was pregnant. Apparently those people didn't bother to read my body language or look at my face when sharing the news. Everything about me said "despair". Yet the congratulations continued. Each time it was like a stab in the gut. Every iteration like another blow to a nail pinning me to a board. "Congratulations" meant "you should be grateful". Saying congratulations meant this should be good news and I don't have the right to have mixed feelings.
The next time a person you know gives birth think a little about what you really want to say to that person before speaking up. If that person is in a difficult situation "good luck" may be the better choice. "I'm sorry" can even be appropriate. "Congratulations" doesn't fit every situation. Think a little longer before speaking. Or speak a little less frequently. It will give you a chance to listen more carefully to what others sound like when saying such things. "Congratulations" can be the salt in a wound.
"Congratulations" could mean "fuck you".