Of course as anything in fitness it's always up for debate.
[1]https://startingstrength.com/article/squat-mechanics-a-clari...
That is, rather than lifting the bar using the legs, lifting the bar by bending back. Of course, Rippletoe would never recommend doing this, and while leaning forward doesn't guarantee improper form, it can sure make it easier.
Leaning forward is okay while doing squats. A heavy weight causing you to lean forward out of your position is bad.
Leaning forward damages your back? Then why are you suggesting deadlifts?
Squats are not hard to do correctly. Risk of injury is probably not higher than deadlifts. And squats work more than just legs. They do work the legs hard, but they also work the back. Front squats will also work the upper back quite a bit.
I agree, front squats are great! But I personally feel squats do minimal to back muscles.
The amount of work the lower back does is directly related to how far forward the body leans (at the hips; I'm assuming we're not discussing bent-back lifts). The lower back does a lot of work in a deadlift to counteract the torque the weight creates via the upper body lean. In a low-back back squat, the amount of work the lower body does is reduced somewhat because the lean and therefore the torque reduced. It's reduced even further in a high-bar squat, and in a front squat the back muscles are mostly doing isometric work in conjuction with the abs to keep your spine from collapsing.
Even if your squat form is bad and you're leaning excessively, you're probably not putting more stress on your back than in a deadlift. Unless maybe you're dive-bombing your squats and letting your lower back round a ton at the bottom.
Squats are great for building leg strength but have a high risk of back & knee injury under heavy loads if done incorrectly. Even if you do them correctly, a heavy load might force you to lean forward which can damage your back. There are much safer lifts for those of us who aren't experts, such as hex bar squats.