As I recall, Cafeterias in the airport don't open until 7:00 AM - Duty Free shops an hour or so later.
A new Hotel was under construction just across the parking lot from the International Terminal (Terminal #1). I don't know its name; but for the most part, even Hotel restaurants don't begin service before 7:00 AM.
It was I who told you about Toribio's Churreria on the Plaza in Barajas pueblo. Other than
Panaderias that's probably the only thing you'll find open that early (5:00 AM). I believe the Metro Station in Barajas pueblo is the 'end of the line,' but I don't know if MetroMadrid operates all night. It's a 'hike' from Barajas Metro station to the Plaza (about 750 m). The bus terminates right on the Plaza.