The onions are there to balance out the strong flavor of the liver. Many recipes use barely-cooked onions, preserving their sharpness. But since I use young livers and cook them minimally, they are tender and sweet. So I like to cook the onions until they too are caramelized and sweet.