I think there might be two separate issues here.
One is that your camera goes wild when you tab out of the window, the other is that you want a method to constrain the cursor to the window without hiding it.
To constrain the cursor you could disable the cursor and draw your own - this is the approach used by most games, see this post on some approaches to drawing your own cursor.
Another approach might be to constrain the cursor by calling glfwSetCursorPos when it reaches the outer edge to keep it inside, though there are likely a few problems in getting this to work well.
Neither of these will help with ALT+TAB issues, as the window looses focus then. You'll need to handle this by not updating the first person camera with mouse deltas when the window is loosing/gaining focus and also beware that minimizing the window causes a window size message of 0 width and height (which can also cause your camera to go crazy if you process these for control).