Heat ¾ cup olive oil over medium heat until shimmering. Add 5 cloves garlic and fry until golden brown.
Add the cinnamon, allspice, cumin seed, pequin chiles, and guajillo chiles. Toast until fragrant, about 1 minute.
Remove from the heat and stir in 2 teaspoons kosher salt, brown sugar, and apple cider vinegar. Let cool for 15 to 20 minutes, then blend until smooth.
Crispy Onions
Heat canola oil in a deep pot to 300°F. Season the sliced onion with salt and toss with enough cornstarch to lightly coat.
Fry the onions, stirring occasionally, until golden brown. Remove from the oil, drain on paper towels, and season with salt.
Beans
Heat the remaining 3 tablespoons olive oil in a sauté pan. Add the remaining 2 cloves garlic and the shallot and cook until the shallot is translucent.
Add the cooked soybeans, lemon juice, and lemon zest. Cook until warmed through.
Transfer the soybean mixture to a food processor and process until smooth, adding vegetable stock as needed to reach a creamy, refried bean consistency.
Season with salt and black pepper to taste.
Serve the refried soybeans topped with salsa macha, feta or cotija cheese, and crispy onions.