1. Place the ham, bay leaves, and 3 quarts water in a large stockpot or Dutch oven. Cover and bring to a boil over medium-high heat. Reduce the heat to low and simmer until the meat is tender and pulls away from the bone, 2 to 2½ hours. Remove the ham meat and bone from the pot. When the ham is cool enough to handle, shred the meat into bite-sized pieces and set aside. Discard the rind, fat, and bone.
2. Add the split peas and thyme to the ham stock. Bring back to a boil, reduce the heat, and simmer, uncovered, until the peas are tender but not dissolved, about 45 minutes.
3. While the peas are simmering, heat the oil in a large skillet over high heat until shimmering. Add the onions, carrots, and celery and saute, stirring frequently, until most of the liquid evaporates and the vegetables begin to brown, 5 to 6 minutes. Reduce the heat to medium-low and add the butter, garlic, and sugar. Cook the vegetables, stirring frequently, until deeply browned, 30 to 35 minutes; set aside.
4. Add the sauteed vegetables, potatoes, and shredded ham to the pot with the split peas. Simmer until the potatoes are tender and peas dissolve and thicken to the consistency of light cream, about 20 minutes. Season with ground black pepper to taste. (The soup can be refrigerated in an airtight container for 2 days. Warm the soup over low heat until hot.) Remove the bay leaves. Ladle the soup into bowls, sprinkle with red onion, if using, and serve, passing balsamic vinegar separately.