As commented by others, without seeing a video of your form or knowing a bit more information it is hard to say if you are doing proper form 100%. Even then, sometimes what one person feels is proper form and causes 0 pain, someone else might have a different reaction. I find this true especially with squats.
You might want to pay attention to how straight your back is, the direction of your legs / knees, and how low you go before you might feel the discomfort.
I found an article which elaborates on this:
The simplest way to fix lower back rounding on the Squat is to push
your knees out harder on the way up and down. If your knees point
forward or in, your lower back will usually round. So Squat with your
heels shoulder-width apart, toes out 30° and push your knees to the
side as hard as you can.
Next don’t Squat lower than parallel. Many people lack the flexibility
to Squat ATG (“ass-to-grass”). If you lack the flexibility to Squat
all the way down, until your butt touches your ankles, your lower back
will have to compensate by rounding at the bottom. This can result in
lower back pain.
Read the full article here
Also give front squats a try. I wouldn't replace regular squats with them, but alternating might give your lower back a break and let you get more insight on whether it is the muscle that isn't adapting or your form that is causing the issue.