This regulation is all very good, as it limits the
extent to which one's credit history can harm one's
prospects at financial progress
Credit history can both help and hurt you. Imagine some people are Q and some are R, and Q-people are more likely to default on a loan than R-people. If we prohibit taking Q-vs-R status into account in making loans this is good for the Q-people because they'll get lower rates, but it hurts the R-people who will get charged higher rates.
Looking at your example of someone who made decisions in their 20s that left them with lots of debt, declared bankruptcy in their 30s, and now is trying to take out loans in their 40s. Do you think that they're more likely to default on these loans than someone who didn't go through that process in their 20s and 30s? If you do, then this is a Q-vs-R thing and one group is being helped but only by mixing them in with another group that's then hurt. (Or if you don't think they're more likely to default then they shouldn't be charged more for loans. And if they are charged more for loans, you/someone could go into business loaning to these people and make a bunch of money.)
Some examples are a lot harder than others, though. Say one race, as a group, tends to default a lot more. There are probably lots of reasons for this, with poverty being a big one, but say even after you take into account the rest of the data you can collect (income, age, years at job, profession) race still has lots of explanatory power for predicting whether someone will default. Should you be able to take this into account? This is another Q-vs-R thing, but it's not based on "poor financial decisions" or in fact anything within that individual's control.
On balance this regulation may well be beneficial, but we also need to acknowledge it has costs. (One thing in favor of regulation: the costs tend to fall on richer people and the benefits on poorer people, so because of the diminishing marginal value of money it could be worth it even if the benefits were smaller than the costs in absolute terms.)