Neumann problems for $p$-harmonic functions, and induced nonlocal operators in metric measure spaces