I am sorry about your wife's bad experience, it must have been very hard time for her since she is in high pregnancy.
But, put aside the fact it is your wife and put yourself in immigration officer's shoes. Pregnant woman close to her due date, taking flight from Lagos to Baltimore around 38 hours long (direct flight, correct me if I'm wrong), all alone with no escort, stops in Canada to take some selfies because she have heard how people are nice here. Coincidentally her husband applied for SINP, and she also has intention to immigrate since she already has Express Entry profile.
Each and every thing that officers have done, they have right to do it no matter what you think of it. Their job is to do checks, to search your cell phone, to ask you questions about your intentions and to find out who is entering the country. And to stop suspicious people from entering.
You should have known that before you let her take that flight and risk both your and her chance to immigrate to Canada, and especially her and babies health.
Yes, they should have asked her how is she feeling after that long flight and if she would like to drink some water, but it is not their job, it would be just a humane gesture.
You are the only one who should take the resposibility of your decisions and your acts, don't blame the people for doing their job properly.
It sounds inhumanely, harsh and brutal, but this is from the perspective of somebody who is not emotionally involved in this case.
Better luck next time and think twice before you do such a big step