You can't build the factory on ores, you are need to remove it before.
Compatible with all mods, works in multiplayer and costs no extra UPS.
(added 'resource-layer' collision mask to some buildings).
I guess your script just adds ore layer to every collision_mask, however LTNs secondary entities use only "layer-11" so they don't collide with the stop entity.
The fix should simply be blacklisting "logistic-train-stop-input", "logistic-train-stop-output" and "logistic-train-stop-lamp-control".