Could be the smart junction box or wiring. I have never seen a sjb be intermittent. I am not saying they can't be I just haven't seen it. Easy to test through. Find the wire coming out and check to see if there is a signal light right at the sjb when the tail light is not working. Not sure why there is guessing and part changing and hoping for the best.