In a large pot, heat oil over medium-high heat. Add onion and cook until soft and translucent. Add garlic and cook just until fragrant, about 30 seconds. Add masa harina and stir to combine. Whisk in chicken stock. Add in chicken, enchilada sauce, pinto beans, cumin, and salt and pepper. Bring to a boil. Lower to a simmer and cook for about 10 minutes or until thickened. Remove from heat and stir in cheese until melted.