Superposition operators and functions of bounded $p$-variation