If it hurts that much to stretch your hamstrings you're already very out of shape. You have other things to worry about as well. Pursue a fitness program, not just squatting.
This is an unfounded and unhelpful generalisation. I’m nothing close to what people would consider “very out of shape”. Yet hamstring stretches are something I definitely do not enjoy doing but force myself to do through necessity. They’re the first thing I’ll skip if motivation is waning precisely because of the discomfort. I find almost all other stretches to be at least someone endorphin producing and worth the stretch. Hamstrings are pure discomfort.