Tunable geometric phase of Dirac fermions in a topological junction