Of course it is not flawed. It just teaches and trains students how to manage capitalism. Yes, there are some malfunctions of the system from time to time, but mainstream economics should justify that and find solutions not to question the functioning itself.
Does mainstream economics teach students that there are intrinsic relationships between profit-making as a driving force of capitalism and how 8 people own more than half of the world population, uneven-development, wars, and other crimes? Or, does it teach how to have entrepreurial spirit and business ambition, i.e. individualism, promoting NGOs to massage power relations rather than challenge them, "free-market" as a universal recipe, and "balancing the relationship between labour and capital to serve capital"?