The documentation about Session Unification seems to state that when on, if the requests progress from not having userId to have an actual one, it considered the same user; but if the requests suddenly stop having the userId parameter, it is considered a log out and those request are not considered part of the same user.
Session Unification ON, see step 4:
So what would happen if a request with no userId is issued in between two with userId?
Does the lack of userId in request #2 causes a tear down of the user timeline in GA? Is request #3 accounted as part of the user?
In your example, the hits/events in Session #1 and #3 will be merged, but not from #2. Thus, userId 5 will show 2 sessions in the user-id view. In the 'all' view, you'll have 3 sessions and 1 user.