The switch itself may not be, but the mechanical effects (hole in case, board space, waterproofing, design testing and as GP said, warranty) makes it expensive.
How come they can make a thin, power sipping high resolution OLED panel for like $100 that fits in a phone but they can't make a reliable switch that ensures privacy?
And the iPhone is coming with an mechanical switch since the first one, even in the waterproofed phones from the newer generations.
That's a business case problem. Not enough people are asking for it. It's expensive because it lowers their margin by a notable (maybe not huge) amount. No one said it couldn't be done, just that it's effort for too little payoff.
I have no horse in this race, but switches are constantly manipulated physically, and can see more abuse and stress because of that.