On main track under the control of a dispatcher (not within yard limits), the use of a portable derail is usually not required. The crew will likely also have a copy of the "Form B" which is the written notice of the gang's working limits. In the event the yellow/red or red flag are missing, the restriction on the Form B still applies if within the listed time limits.
This can get interesting if the track gang leaves without pulling their expired red flag because there's no one left to talk the train past it, so it's stuck for a while.
Depending on the track, authority, if there's a dispatcher and the work being done, the methods used to establish working limits for roadway workers can vary depending on their FRA compliant program.