How does a HUD track a runway?
Correct, that optional feature on the 787 relies on the ILS or GLS signals.


  On takeoff, HUD provides lateral guidance for takeoff roll and rejected takeoff using ILS or GLS signals.


(FCOM 4.20.7)

PVD (Para-Visual Display) is a similar instrument (in function) that was available on the 747-400 as an option that relied on the ILS (shown below).


(aerowinx.com) PVD.



Further reading:


Peripheral Vision Displays (nasa.gov).
The crash of Singapore Airlines Flight 006 during a takeoff in LVP conditions.