I’m not sure you’re going to be able to find a full tail cap replacement for that, but if you’re handy you can probably take the whole tail cap apart clean everything really good and hopefully it won’t do that again. For now I would probably just leave it since it’s working
there are some complete lights on Amazon
Teeny ball of Al foil all scrunkled up to take up the space and provide a bit more pressure?
Squoosh it into a cylinder, wrap tape around the edge as to not short to the tube. I did that to be able to use 14430s for 14500s.