Because during the repair or booting phrase, the bluetooth paired input devices are not connected. You might notice that MacBooks may work because their keyboards are wired and directly used as inputs during the booting phrase(it's just the order of booting or BIOS).
I remembered that for Macs(not iMacs) they usually go into safe or recovery mode when long pressing the start up button as the command keys.
Also I think Allan Jones is right, is this iMac 2014 24 inch or 27 inch model? They are in the other newer models forum, you can try to also host a discussion there:iMac - Apple Community