$p$-adic sheaves on classifying stacks, and the $p$-adic Jacquet-Langlands correspondence