Dissolve yeast and sugar in warm water and let sit 5 to 10 minutes until foamy.
Add melted butter, salt, and flour gradually to the yeast mixture and mix until dough forms.
Knead dough for 6 to 8 minutes until smooth and elastic, then place in a greased bowl, cover, and let rise for 1 hour until doubled.
In a medium bowl, mix cream cheese, shredded cheese, diced ham, scallions, garlic powder, and black pepper until creamy.
Preheat oven to 425°F and line a baking sheet with parchment paper.
Divide dough into 6 portions and roll each into an 18-inch rope.
Flatten ropes slightly, spoon filling down the center, fold dough over filling, pinch seams tightly to seal, then shape each into a heart.
Bring water to a boil, add baking soda, and gently lower each pretzel into the bath for 20 to 30 seconds.
Remove pretzels with a slotted spoon, place on baking sheet, brush with beaten egg, and sprinkle with black pepper and optional coarse salt.
Bake pretzels for 12 to 15 minutes until deep golden brown with slightly crisp edges.
Transfer baked pretzels to a cooling rack and serve warm.