I know there's at least one level 4 lock in Detroit in the first section of the game. However, I'm wondering how soon I need to max out my hacking skills if I want to be able to hack absolutely everything.
I would upgrade to level 5 before leaving Detroit for the first time.
The police station has at least a level 4 hack for the armory, as I recall - it might be level 5 - and you will not be able to get in on your second trip to Detroit. So you need level 4 if you want to do all the hacking you can.
However, once you have level 4, you can upgrade to level 5 to break in to an illegal aug shop in the Brooklyn Court apartment building in Detroit. Inside of that aug shop, you can find a Praxis kit. This is accessible later, but since the upgrade pays for itself and will make your future hacking easier, you may as well get it as soon as you can.