e.g. an external path-finding algorithm is given a start and end position, then calculates a path. The general approach for this sort of thing is to just flood-fill every tile between start to end with numbers representing distance from the finish line (some biases are added to avoid going too far off track, at the expense of missing perfect paths sometimes), then the entities just look at the value of where they are, and roll to the nearest tile with a lower value, eventually getting to the exit. The dwarves themselves just act like balls rolling downhill: but the pathing algorithm decides on where the hills are.
Dwarfs don't
decide where to go or what to do, there's a central puppet-master who dictates who's doing what and which direction they must go in. e.g. dwarves are individually as intelligent as marionettes. The question is therefore a case of
category error: you wouldn't ask whether the
puppets in a play are intelligent entities, you'd ask whether the guy pulling the strings is. e.g. if it turned out there was a
machine up there controlling the puppet strings instead of a human, that doesn't make the
puppets any more intelligent or individual.
Also there's plenty of evidence that single-celled organisms act in fairly complex ways. Sure, bacteria aren't self-aware. But we're talking relative to dwarves in DF here, not to humans.
https://www.quantamagazine.org/the-beautiful-intelligence-of-bacteria-and-other-microbes-20171113/