To make the filling, heat the oil in a large skillet over medium heat. Add the onion layers to the skillet and cook, turning frequently, until blackened on all sides. Remove from the heat, and scoop the onions out of the skillet and into a blender or food processor, preserving the oil.
Add the red beans and the bean liquid to the blender, and blend until smooth. Pour the bean mixture back into the skillet with the oil. Cook over medium heat, stirring frequently until thickened. Stir in the salt and adjust seasonings according to taste. Let the beans cool while you make the dough.
In a large bowl or the bowl of a stand mixer, beat together the corn masa flour, salt, and hot water, until the dough is thick and sticky. Let rest for 15 minutes.
Scoop the dough into 12 equal-sized balls, about 1/4 cup each (I used an ice cream scoop to make things easier). Cover the balls with a damp towel so they don’t dry out while you’re assembling the pupusas. Stir the cheese into the cooled beans.
To assemble the pupusas, flatten a dough ball in your hand (you can spray your hands with cooking spray to prevent the dough from sticking if you prefer). Pinch the sides of the dough up to form a cup shape. Drop 2 tablespoons of the bean mixture into the center of the dough, then fold the edges over to enclose the beans completely. Gently flatten the dough to a 4-5 inch disk. Repeat with remaining dough balls.
Heat a large skillet or griddle over medium heat. Cook the pupusas for 3-4 minutes per side until the center puffs up slightly and the sides have browned spots. Serve warm.