The best way I can respond to this is by pointing out that promoting 'values-based' foreign policy (or at least claiming to) is a privilege of economic power.
Why can the United States impose economically harmful sanctions on countries for human rights violations and other illegal or immoral actions (eg Russian invasion of Ukraine)? Because it has the power to do so - it's the richest country in the world, it has the world's reserve currency, it controls most international trade routes, has a significant degree of control over the global financial system, banks and companies will comply with US sanctions to be able to do business in the US, etc.
A country that violates human rights or international law isn't going to be seriously hurt by Brazil or India imposing any kind of economic sanctions on them, so there's no point for these countries to do so - at least for now. These countries' foreign policy is about increasing their influence elsewhere and growing their economy so that they can one day be as powerful as the United States.
Maybe one day when either India or Brazil is the world's largest economy and has a significant degree of control over the world's financial system they will be able to sanction a country for violating human rights or international law. But if you're a poor country, what's the point of limiting your trade networks simply on 'values-based' concerns that will have little to no aggregate economic impacts? It's not, as you said, in their national interest - and these countries want to protect their national interests.
a country's national interest can be defined more or less narrowly and upholding a rule based international order can be in the national interest of a country (when it comes to basic principles such as non-aggression it is arguably in the interest of most countries).
India has the world's 3rd largest economy based on PPP and is a major player, which could potentially choose a stakeholder approach to international relations. The countries we're talking about are not "poor" but middle-income countries.
plenty of small and mid-sized economies pursue a foreign policy with a strong value based element, it is not the prerogative of super powers.
economic sanctions work if enough of the major economies support them, as the Ukraine war has shown even the US can't impose efficient sanctions on its own.