Technique is the first thing people blame when they get injured while lifting. Deadlifting with a rounded back, knees caving during a squat, or doing "harmful" exercises like upright rows have all been blamed for injuries. And while doing something "wrong" can lead to problems, it doesn't happen for the reason most people think.
Pain is complex and has many inputs, many of which have nothing to do with something being physically "wrong". But for the sake of discussion, let's assume the pain comes from an actual physical problem.
When tissue gets stressed but not excessively damaged, it adapts to handle that stress in the future. As long as your tissue can handle the demands of the task(s), either acutely (short-term) or chronically (long-term), you’ll stay injury-free.
If your tissues cannot handle the stress, injury can occur. But here's the crazy thing. Our bodies can adapt to a wide variety of movement patterns and stressors as long as we don't let those stressors get beyond a certain threshold. This means you can adapt to deadlift with a rounded back, squat with your knees diving in, or do “harmful” exercises without incident as long as you appropriately load the exercise.
I have seen people move insane amounts of weight with what appears to be "terrible technique". They can do that because their bodies have adapted to handle a load that way. They are prepared for it. If any of these people were asked to keep the weight the same and do the movement the "right way", they would likely see a higher risk for injury.
Does this mean we shouldn't coach movements at all and just let people move "incorrectly"? Nope. Because while people can adapt to different techniques, certain techniques are more conducive to load-bearing, are more biomechanically efficient, and many movements need to be done in a specific way to target the muscles we want to target.
The moral of the story is that we should coach movements in a way that allows the person to better handle the load and target the right muscles, but we should not immediately jump to the conclusion that our technique is causing any injuries we get along the way. We need to also take the load, volume (sets and reps), other stressors, and recovery into consideration. Sometimes, we just aren't prepared for what we're asking our bodies to do on that particular day.