Have you considered adding a fast-replace group to these rails so they can be built with an upgrade planner? 0.17.54 just fixed a bug that used to break rail construction with this feature enabled and the code's a pretty trivial add to the entities.lua file.