The second- and third-order azimuthal anisotropy Fourier harmonics of charged particles produced in pPb collisions, at $\sqrt{s_\mathrm{NN}}=$ 8.16 TeV, are studied over a wide range of event multiplicities. Multiparticle correlations are used to isolate global properties stemming from the collision overlap geometry. The second-order "elliptic" harmonic moment is obtained with high precision through four-, six-, and eight-particle correlations and, for the first time, the third-order "triangular" harmonic moment is studied using four-particle correlations. A sample of peripheral PbPb collisions at $\sqrt{s_\mathrm{NN}}=$ 5.02 TeV that covers a similar range of event multiplicities as the pPb results is also analyzed. Model calculations of initial-state fluctuations in pPb and PbPb collisions can be directly compared to the high precision experimental results. This work provides new insight into the fluctuation-driven origin of the $v_3$ coefficients in pPb and PbPb collisions, and into the dominating overall collision geometry in PbPb collisions at the earliest stages of heavy ion interactions.