I can't speak specifically for the Navy, but as an Army officer I've been part of the pipeline that turns recruits into air traffic controllers, which is a pretty in-demand role. [I've also been part of the pipeline that turns college students into officers and pilots, but they don't go through "boot camp" in the same sense that enlisted members do.]
Your intuition is sort of correct, but sort of backwards. First, someone who qualifies for an in-demand role is less likely than most recruits to wash out because they are more qualified than the average recruit to begin with. Second, if someone fails along the way to becoming an air traffic controller or linguist or some other difficult job, there are a lot of other jobs that they can step down to and handle with ease. So we'd say, "Hey, you didn't make it, but this is a tough program so there's no shame in that, and here's another program that we can send you to do instead, if you want." On the other hand, if someone signs up to be a shower and laundry specialist (yes, that's a real job) and they fail in that program, we probably don't have much else that they'd qualify for, so they might be out of luck no matter how much they want to stay in uniform.
Edited to add: Of course, "boot camp" is "boot camp" for everyone, (mostly) regardless of the specialty that they signed up for. I'm mostly speaking above about the second stage of training.