Here’s my anecdotal evidence. I had a very bad neck pain for the last few years, sometimes it can be very acute with no obvious trigger. I almost wouldn’t be able to move my neck at all. I tried to cut my laptop and phone use, but to very little avail. Untill one day I accidently found it’s acutally more like my trapezius than my neck, then I realized it was from weight training—the activity that was supposed to improve my posture and muscles. Then I finally zoomed in onto one exercise: the squat. Holding the bar required squeezing my shoulder blades and, your guessed, trapezius. The squeeze was so slight I never felt any immediate discomfort. But from a post hoc perspective the acute neck pain usually occured a few days after the workout. The causal link is very hard to notice. But once I stopped doing squats, the neck pain almost never occurred again. And you’d think if it’s the trapezius then exercises that utilize the same muscle would cause the same symptom? Yet the answet is no.
That, or bar placement too high on the neck, or involuntary neck straining (chin goes up, back of neck goes forward), or maybe just too much weight. It's a compound exercise where a lot can go wrong.
How do you position your neck during the squat? I.e. do you try to look at the ceiling, or do you gaze at the floor? I ask because my football coach gave me the "look at the ceiling" advice back in the 80's - which was a standard movement cue back then, designed to help maintain lumber extension - and so I suffered neck pain after squatting for years.
The more modern advice to maintain a neutral spine and let one's gaze rest somewhere below horizontal has made squatting a pain-free experience for me.