How do I disable the media keys (play, pause, skip, etc.) on the macOS login window?
Two solutions:

Solution 1: the aforementioned one to toggle the Use F1, F2, etc. keys as standard function keys and then lock the screen via an AppleScript invoked by a system-wide hotkey:

display notification "Toggling fn keys and locking"
-- toggl fn keys
tell application "System Preferences"
    reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
end tell
tell application "System Events" to tell process "System Preferences"
    click checkbox 1 of tab group 1 of window 1
end tell
quit application "System Preferences"

-- lock screen
activate application "SystemUIServer"
tell application "System Events"
    tell process "SystemUIServer" to keystroke "q" using {command down, control down}
end tell


Then, the next steps are saving this as an Application, and creating a service in Automator to launch this, and setting a keyboard shortcut for that service.

However, this was too slow and also had the irritating side effect of me having to write another script to un-toggle the Use F1, F2, etc. keys as standard function keys setting after logging back in. 

Solution 2: I ended up using KeyboardCleanTool, which solves the problem more directly by locking all the keys on application startup until one clicks the relevant UI button: 


  KeyboardCleanTool is a super simple little tool which blocks all
  Keyboard and TouchBar input.