--- a/net/minecraft/world/level/block/BaseRailBlock.java
+++ b/net/minecraft/world/level/block/BaseRailBlock.java
@@ -71,6 +_,7 @@
         state = this.updateDir(level, pos, state, true);
         if (this.isStraight) {
             level.neighborChanged(state, pos, this, null, movedByPiston);
+            state = level.getBlockState(pos); // Paper - Fix some rails connecting improperly
         }
 
         return state;
