I'm glad your son is doing fine.
I'm not surprised the airline balked when you indicated to them your son might need the neb treatment on board and they realized you would not be able to plug in the machine. Overall, I think the airline did the right thing by clarifying with your pediatrician he was ok to travel that many hours without the treatment, and then adjusting your flights to get you an extra day. You now know exactly how to get the medical permission notes worded.
Have fun in CUN!