Proper material or method for making water tight seal on ceramic soap dispenser?
The problem may not be related to a leaky seal.

Pumps of this sort would pull the liquid soap into the vertical tube and push it out the spout of the dispenser. If the pump mechanism is working correctly, it will also allow air from a designed-in vent somewhere in the cap.

For the top to be leaking in the manner you describe, it would be a failure of the pump to transport the liquid soap from the vertical tube to the spout and into your hands, not a gap or poor seal around the opening.

You can confirm this by holding the pump mechanism over an open container filled with liquid. Keep the dip tube in the liquid and activate the pump. If the liquid appears other than at the exit spout, you have confirmed a faulty pump.

The above test will also show you that a sealed container is not required for a pump to work. A sealed container will cause problems if there is not an air intake. As the soap level decreases, air must be allowed in or you have a building vacuum which will prevent soap dispensing.