I know where you are coming from. Sometimes I recall the sense of feeling like a part of something vast, eternal and infinite - like how I felt when involved in Hinduism. (And previously, Christianity, though I never really embraced that).
And yet, as you mentioned, that feeling comes and goes
, and so how real or substantial is it really? Just another dream of this dreamer.
I find it useful to sort of 'redirect' that longing (it still exists as 'echoes' or 'ripples' somewhere in my heart-mind) to the Dhamma. I sometimes reflect / meditate upon how the Buddhas have always lived, their customs and ways etc, the eternal truths such as impermanence, and that 'eternal law' mentioned in the Dhammapada ('hatreds never cease by hatred; by love alone they cease'). It is just my attempt to skilfully deal with my own theistic tendency, not denouncing myself for it, but redirecting it. Cos like yourself, when I really question within my heart, I honestly come back to the conclusion that if there really WAS a god 'out there' (or 'in here') that he/she/it would not insist that we cling to and accept words written and passed down by men, above the insight of our own hearts. So I am always for walking away from fundamentalist tendencies, even in the Buddha way, as even Buddha told us not to just accept what he said but to test it out. (this has turned into a personal rant, but still, I hope that something here was helpful!)