With that layover, booking a hotel would be my top priority, and it would likely be the Novotel:
https://www.novoteltaipeiairport.com/
Those 5a arrivals often show up early, so you might be looking at a solid 3 hours before things come to life...that's 3 hours in which you could be relaxing in a real bed. After that, you can decide whether or not you want to head into town (easily doable).
I'd aim to get to the gate area for your onward flight at about 2p (so, maybe plan exit/security for ~130p).