A law of large numbers for branching Markov processes by the ergodicity of ancestral lineages