It’s a creative decision and happens quite often! It’s a way to insert a specific nuance into a word, in this case that the light is a source of hope. [“even if the light of hope looks like it’s going to disappear, go on”]
They use furigana to show how it’s read and kanji to show what it means, sort of. Like in Fullmetal alchemist where they write automail like so: 機械鎧 to indicate that it means machine armor.
It can also be used to show what a character refers to: in 僕だけがいない街 they have マンガ業界 and 編集者. So basically he says this business and that guy but the kanji/katakana show he means the manga buisiness and the editor.
And in the Hunter x Hunter OP they have あおい地球にありがとう to show that the blue star refers to the Earth.
Now that I think of it, I think I’ve seen furigana like your automail example for made up words, but your example of “friend” read as “enemy” is something I’ve never seen before. That’s super interesting!
Disclaimer: I haven’t seen that one in person, That was from an episode of 日本人の知らない日本語 that I happened to watch years ago and now can’t find.
Basically the students started making ever more absurd claims about alternate readings of kanji that they’d “learned” from manga. Eventually the friend/enemy one came up
That particular one may or may not exist, but it still illustrates the extents it can be taken to