Probably some glitch or maybe something with the security system that tripped and wouldn't allow anything. Even if the FOB doesn't work you can still press the start button and the accessory stuff will come on if I remember right? There may be codes stored in the computer that a dealer or somebody with the ForScan app would be able to read.
Batteries can go bad, but the Motorcraft AGM battey should last more than a year or 2
Unable to lock/unlock/remote crank from the fob...
Likely you had either sat on or squished up the fob in a pocket. This could randomly strike the buttons and/or hold them long enough to cause considerable fob battery drain. But, the fob may have fallen out of sync with the receiver on the truck.
As I understand it, fob remotes use a rotating cipher that stays in sync with the receiver...typically. But if the buttons are pushed too many times and the ciper changes without being in range of the receiver, that can cause them to lose sync and nothing happens when you're back in range and start pushing buttons.
But: within 10 ~ 20 repeat attempts, (manufacturer dependant) the fob and receiver realize that they lost sync and will re-sync after multiple fob button presses. But if the fob had a weak battery, it may have missed the cue from the vehicle receiver to restart the hash sync.
Curiousity - i had a second-owner 2009 volvo which had a lot of bells and whistles. It would do this a couple of times per year and would eventually start after a hat dance and multiple attempts. Get out, close the door. Lock, unlock, get back in. During the no-starts, it would display “vehicle immobilizer” or something like that. Ford started going to the advanced can bus interfaces after they bought volvo - I wonder if this is tech-sharing glitch. Volvo was key-start.