Communism needs direct intervention in real life because humans are not a hive mind of clones with only minor variations according to specific templates. The dwarven race of Dwarf Fortress, on the other hand, are implemented this way, because it's the only feasable way to implement any large number of similar objects in a computer simulation.
That's not really true. Think Majesty: a game where all characters are "clones" but because there are different classes of characters they are forced to behave very differently. Only peasants can build or repair constructions, and only heroes can do other jobs.
When discussing the future of laws in DF, they have talked about making different laws that could possibly apply to different classes of people, in the sense that there will be certain citizens that the player won't be able to force to do certain kinds of jobs, etc. That's far from impossible to implement.
This is the final stage of communism, at least how Marx envisioned it, and Fun happens when the player fails at it, whether due to carelessness, the RNG, or most commonly, both.
I don't think Marx envisioned, as his final stage of communism, a society where assumedly an administration (read: the player) can forcefully and arbitrarely create a caste that can be put into a burrow, closed off in a room and burned to death when magma pours onto them from the ceiling. Or a class of dwarves that only do hauling, and live in tiny 1x1 rooms where your cheesemakers for no apparent reason live in palaces. To be honest, the way the laws currently work it's all very arbitrary. Most people play the game a certain way because it seems mostrous to torture and kill your own citizens at will, but there are very few consequences to that. If you're a skilled player, you can easily kill all children and useless immigrants without having a tantrum spiral because there are ways around that as your dwarves aren't really programmed to be that upset about mass murder under the player's hand. If that's what Marx envisioned I'm truly glad the Soviets failed. Actually, one could argue that the current DF society is more similar to Soviet style socialism than the envisioned final of cientific socialism the modern left argues for. But that's not really a debate we want to have here....
trust me, I knowWhile programing a way of making your dwarves aware that the player is committing genocide would be very hard, as there are few ways I can think of that the game could detect if it was an accident or if you're actually systematically putting your citizens in lava chambers, things like
class struggle are very implementable. Certain dwarves can be peasants so they can only do these kinds of jobs, others are artizens members of a certain guild, so they get upset if you forbid them from working on their trade or force them to do other minial jobs. Maybe the entire guild is upset by this, or maybe there's a hard law in the fortress that outright prevents you from making these dwarves work on whatever else and you'd have to alter that law to make it so but altering laws would have consequences. Peasants only allowed to work minial jobs would perhaps be upset by their situation, and etc.