I have struggled against this for a long time. I tend to be a pretty prideful person and the urge to shift blame when I fuck up and deflect when faced with being wrong is something that has I have to actively work to correct. The difference for me came when I was younger in dealing with my parents: My dad was far from perfect and there were plenty of times he was in the wrong, but always made sure to sit down with me and apologize if he fucked up. My mom, for the most part, was better at avoiding being in the wrong in the first place, but when she was, I never once got her to apologize or admit her mistake. Of the two, I was hurt far more by the latter, and make it a point to be willing to admit my shortcomings.
The most difficult part after I identified it as an issue is to not let my willingness to apologize/admit my mistake become a carte blanche for continuing the behavior. If I fuck up, apologizing only means something if I work on the mistake. If I am wrong about somethimg, I should learn about both the thing and where my misconceptions came from.
For a lot of people, realizing it is an issue is difficult, because you first have to let go of the pride by acknowledging it. Shame isn't a good motivator, as it makes most people double down on pride.