We investigate thermal phase transitions to a valence-bond solid phase in SU(N) Heisenberg models with four-or six-body interactions on a square or honeycomb lattice, respectively. In both cases, a thermal phase transition occurs that is accompanied by rotational symmetry breaking of the lattice. We perform quantum Monte Carlo calculations in order to clarify the critical properties of the models. The estimated critical exponents indicate that the universality classes of the squareand honeycomb-lattice cases are identical to those of the classical XY model with a Z4 symmetrybreaking field and the 3-state Potts model, respectively. In the square-lattice case, the thermal exponent, ν, monotonically increases as the system approaches the quantum critical point, while the values of the critical exponents, η and γ/ν, remain constant. From a finite-size scaling analysis, we find that the system exhibits weak universality, because the Z4 symmetry-breaking field is always marginal. In contrast, ν in the honeycomb-lattice case exhibits a constant value, even in the vicinity of the quantum critical point, because the Z3 field remains relevant in the SU(3) and SU(4) cases.