Do I need separate expansion tanks for my boiler and hot water heater?
I cannot see why an expansion tank would be required with a tankless waterheater. The heater only comes on when a valve is opened and water is flowing through the tankless heater and the pipes. When all the valves are shut the tankless heater turns off. The hot water trapped (marooned in the hot water lines) cools and contracts. The heated water pipes also contract and there would only be an increase in pressure if the volume of the pipes decreased more than the decrease in volume of the trapped water. I don't believe it does and anyway the volume in the pipes is so small that any pressure increase in the pipes would be negligible.

Pressure increase in the water system of a residence with a hot water tank occurs because when hot water is used the water in the tank is replaced with cold water which continues to be heated after the valves are turned off. This large volume of cold water expands significantly as it is heated from cold to about 140 F. If the residence has a backflow prevent valve, then the increased volume of the now trapped water leads to an increase in pressure to the point that pipes or fixtures can be damaged. But if the residence does not have a backflow prevent valve, then the pressure in the house will not rise but will simply stay at the pressure of the water main.

Addition in editing

In another thread on this site someone made the statement that most or all city water meter "yokes" have a simple check valve to prevent backflow. I have not tried to confirm this for Dallas TX where I live. This would mean that all residences with a hot water tank could benefit from having an expansion tank, but AFIK expansion tanks are not used in Dallas. We had tank water heaters for 30 years and noticed no sign of pressure build-up. However, water pressure at the meter here in Dallas is relatively low, I think about 50 psi.