Although not all rail systems in all countries use axle counters for presence detection. In the US freight industry we use track circuits - https://en.wikipedia.org/wiki/Track_circuit
That's not a replacement, that's the older technology.
Axle counting guarantees that there isn't a detached, derailed wagon fouling the line, or a wagon with dirty wheels which aren't completing the track circuit.
Axle counting guarantees that there isn't a detached, derailed wagon fouling the line, or a wagon with dirty wheels which aren't completing the track circuit.