Set a medium oven-safe pot over medium heat and add the bacon. Cook, stirring, until most of the fat is rendered and the bacon is crisp, about 8 minutes; remove to paper towels with a slotted spoon to drain.
Add the onion, garlic and ginger to the drippings in the pot and cook, stirring occasionally, until soft and golden, about 5 minutes.
Add the tomato paste and cook until the color deepens, about 1 more minute. Add the root beer, vinegar, molasses, mustard, red pepper flakes and garam masala to the pot. Stir, then bring to a boil. Add the beans and three-quarters of the bacon and gently stir so the beans don’t lose their shape.
Reduce the heat to medium low and simmer until slightly thickened, about 15 minutes; season with salt and pepper.
Transfer to the oven and bake, uncovered, until thick, about 30 minutes. Let cool slightly, then top with the remaining bacon.