Thinly slice 2 onions. Heat 1/2 cup oil in a large skillet over high. Add sliced onions; cook, stirring constantly, until onions are coated. Reduce heat to medium-high; cook, stirring often, until onions start to soften and brown on the edges, about 5 minutes. Reduce heat to medium; cook, stirring frequently, until onions are deeply brown and crisp, 35 minutes. Reduce heat to low, and stir in half of the garlic; cook, stirring constantly, until fragrant, about 1 minute. Transfer onions to a paper towel–lined plate and sprinkle with 1/2 teaspoon salt. Let onions cool, about 10 minutes.
While onions cook, coarsely chop remaining onion. Heat remaining 1/2 cup oil in a large skillet over medium. Add chopped onion, kidney beans, tomatoes, coriander, cumin, turmeric, and remaining 1/2 teaspoon salt. Bring to a boil over medium. Reduce heat to low, and simmer, stirring often, until mixture is thick and liquid evaporates, about 20 minutes.
Remove skillet from heat; mash beans with a potato masher or a fork so the mixture is easily spreadable but still has texture. Stir in lime juice and pepper. Add additional salt to taste, if needed. Top with fried onions, and serve warm with flatbread or sturdy, ridged potato chips.