I always wonder at this. I've seen those expensive repair bills and they're usually expensive relative to the value of the car to be repaired, but they're cheap relative to the cost of a brand new car.
You can get a loan for a new car, you can't get a loan for repairs. If you manage money well this is rarely a problem, but if you don't then you have no savings to pay for the repairs. The other problem with repair is what else is wrong and what will that cost to repair.
I've been told that there are people who trade their cars in when the tires are worn out - it kicks the payments down the road a month (they have to budget next month lower than this month, but it doesn't use cash they don't have) Remember, nearly anyone can get a car loan no matter how bad their credit is. Even a credit card has higher standards. Since we are talking about people who are bad with money it is at least believable.
My experience has been exactly the opposite. Everyone I know who trades out cars every year or so does it because they want the latest and greatest, or just something new and different, not because they can't afford to repair it. The people I know who have more limited means tend to drive their cars until the wheels fall off, and they are pretty familiar with their mechanic. I'm a little too impatient for that myself, I have a fairly low threshold of 'how many is too many repairs' before I dump a car and get something with less hassle.
Just went through this calculating a few months ago.
Had a 14 year old car... 225k miles on it... a couple years ago had put in $1k or so, but the last 18 month had put in less than $500 in repairs (tires, oil changes, some other issues).
However, there was an oil leak, and some damage to front-end suspension. Oil leak had been going on for a while, but getting worse. Finding it would have meant taking the engine apart, and the front-end stuff was also expensive. Even without the engine leak, I was looking at probably $1500 to get this to pass inspection this year, and... there's no guarantee that all the fixes wouldn't have left me with something with a broken transmission that needed an overhaul or replacement. Fixing it all would probably have been north of $3k to feel good that it would be road worthy for at least another few years.
As much as a I hate change, I bit the bullet, and got a 'newer' car for $11k. 'used' but still relatively new (2016) and it's far more fuel efficient - getting around 40mpg vs the 25 I was getting before. The fuel efficiency won't totally make up for the entire diff in fixing vs replacing, but I have something that's more modern, more comfortable, gets better mileage and better safety features. The 'brand new car' comparison - yeah, but loads of people are fine getting a 'lightly used' car vs 'brand new'.
A friend went through similar decision within 10 days of my process, and he ended up getting a lightly used car (2017?) but it was $21k - I just can't bring myself to pay that type of money for a car right now. I was looking sub $10k; my wife pushed me to go a little higher.