I have a motion sensor installed which turns on the garage lights when triggered by moving garage door in low light. No need to do fancy things with the pilot light off your opener.
Newer garage door opener motors no longer have pilot light sockets in them, but in-built surface mount LEDs which can’t be tapped, meaning a solution like yours would be required instead. Alternatively, a reed switch to detect when the garage door is open - triggering some action which is up to you.