How do hydraulic disc brakes make sense on these styles of bikes, given the tendency of pistons to "stick" when dust makes its way inside
MTB brakes don't actually have much of this tendency. I've had my brakes covered pretty gruesomely in mud, and spraying with water was always enough to get them working again. Not great – they'll certainly go a bit shrieky – but not sticky. Anyway,
as it inevitably will on trails?
– well it won't, “inevitably”. As long as you maintain a bit of speed, centrifugal force will generally keep the dirt away from the brakes, very much unlike with rim brakes. The times I got my discs muddy was only when I got completely stuck in really bad bog holes, so the mud would drip from the top of the wheel onto the cassette and brake. Yuk. Surely you'll agree that it's best to avoid these situations entirely. But what is quite inevitable is getting dirt on the rim surfaces, when riding in any wet conditions. So that's where the biggest advantage of discs over rim brakes lies.
In dry conditions, you'll certainly get some fine dust on the disc brakes, but they can deal with that no problem.
All the dirt considerations aside, hydraulic discs are just the type of brake that works best. They have excellent modulation, plenty of power when you need it, they seldom need any adjustment, and wear the pads more evenly than mechanical brakes... what's not to like?
Sure, every kind of brake will degrade when handled badly. Regularly dunking in mud is certainly not the smartest thing to do with discs, not to mention getting any sort of fats on the surfaces. The only brakes immune to those issues are caster brakes (enclosed in the hub), however those are no good for prolonged use at all, nor are they compatible with derailleurs or usable on the front or allow back-pedalling. In short, not at all an option for MTB.
The only way I could see this changing is if somebody finally got a good electric hub motor design out that can double as an anti-locking regenerative brake. That really would be a game-changer. But unfortunately the e-bike market is all on the mid-engine ship, with no consideration for regenerative braking.