The algorithm does not properly detect which belts are driven by an engine. To see this, build the pattern of belts shown in the image, placing entities in order from bottom to top. When the entity on the top is placed, two belt tiles will halt even though they are connected to an engine.
https://imgur.com/a/FNn6Vqo