Rinse the dried mushrooms thoroughly by soaking and draining them multiple times to remove grit, then soak them in cold water for 8 to 12 hours or overnight to soften and produce flavorful soaking liquid.
Drain the sauerkraut carefully, squeezing out any excess liquid; rinse briefly if it tastes too sour, then chop it finely for the filling.
Strain the mushroom soaking liquid through a fine sieve to remove impurities and finely chop the softened mushrooms.
Place chopped sauerkraut in a large pot with bay leaves, allspice berries, sugar, black pepper, salt, and about 1 cup of liquid composed of mushroom soaking liquid and water; cover and simmer on low to medium heat for 45 to 60 minutes, stirring now and then until soft.
Heat oil or a mixture of oil and butter in a skillet over medium heat, sauté the chopped onions until soft and golden, then add the chopped soaked mushrooms and cook together for 5 to 7 minutes to reduce moisture and enhance flavor.
Transfer the sautéed onion and mushroom mix into the pot with cooked sauerkraut, mix well, and continue cooking uncovered for 15 to 20 minutes to evaporate extra liquid; finally, remove bay leaves and allspice berries and let the filling cool completely.
In a large bowl, combine flour and salt, then pour in very hot water mixed with melted butter; stir quickly and knead the dough for 5 to 7 minutes until smooth and elastic, then cover and rest it for 30 minutes.
Divide the rested dough into portions, roll out each piece on a floured surface until thin, and cut out circles approximately 7 to 7.5 cm wide; lightly dust with flour to prevent sticking.
Place a rounded teaspoon of cooled filling onto each dough circle, gently stretch the edges, fold into a half-moon shape, and seal tightly by pinching or crimping to avoid leaks; keep the formed pierogi covered with a damp cloth as you work.
Bring a large pot of salted water to a gentle boil, cook pierogi in batches until they float, then simmer for an additional 3 to 4 minutes; remove them with a slotted spoon and lightly coat with oil to prevent sticking.
Optionally, pan-fry the cooked pierogi in butter or oil until golden for a traditional finish before serving.