> I've always found it odd that there isn't a standard command to write stdin to a file that doesn't also write it to stdout

If you happen to have moreutils installed, you can do that with pee

    echo $NUM_PAGES | sudo pee 'cat > /proc/sys/vm/nr_hugepages'

why not write sh -c then?

Because 'sh' isn't in moreutils and is harder to remember, next question.

Why use something portable when you can use cat pee?

Personally? Because I hate the smell.