Water expands when heated. Water cannot be compressed so the expansion must go somewhere.
Many homes connected to a muncipal water supply were previously not equipped with backflow prevention devices, so any water expansion occuring in the WH, would push back into the municipal system. Now, many municipalities require a backflow prevention device such as a check valve, to be located where the water service enters the home.
If your water supply is equipped with a check valve or PRV, then a thermal expansion tank is needed to absorb the expansion from the WH. When no allowance is made for expansion, the WH TPR valve will usually begin to leak to relieve the stress of the additional pressure on the plumbing system.
If your mini heater is to be fed hot water from the tankless, the temperature rise will be minor so amount of expansion within a 2-gallon heater should be far less to cause the TPRV to begin leaking, but an expansion tank plumbed to the cold water plumbing would provide a measure of safety regardless.
If your water supply is a private well, then the pressure tank will typically absorb any expansion, provided there is no check valve located between the WH inlet and the pressure tank.