All you need to do is to have your custom login lightbox refresh the page it is opened on after it closes so that the code on your page is kicked into gear, just exactly as you mentioned and told yourself the answer in your post above!
I have similar on my members only page where I have only my logo and a login button showing if members are not logged in.
Without my custom login lightbox refreshing the members only page once the member has logged themselves in and the login lightbox closes, then the page will not work as the code won’t be called for the logged in user and the person will actually be logged in, however the page won’t change from login to logout etc as the code is not started.