@APM, I'm not sure how you're persisting the uid /user ID while logged in - localstorage, cookie, native app variable, audienceStream enhanced item in IQ?
But regardless of the method, if you create a new, separate, data layer object that acts as the middle man, and then use that for the mapping to "uid" in the GA tag, that should take care of your issues. Just add the variable, then create a javascritp extension that feeds the variable from whatever your source is - but add in the conditions that you care about (i.e, only feed it when logged in). If you want to be extra safe, you could set the variable to null or delete it before filling it each time to make sure it doesn't persist in some angular/app frameworks.
That said - are you sure you want to do that? removing the UID from google will significnatly limit the analyitcs you can use it for. Especially for sessionsthat are closely linked to a individual person as app sessions are -even when someone isn't logged in, I'd expect a lot of use for being able to look at their entire session's activity in GA from unauthenticated to authenticated and back.
Also, if you aren't also reseting/clearing the cid/_ga cookie value, clearing the UID may not break the session analytics as much as you were hoping since non-UID properties will still catch the entire session..
... View more