Yes , you have diagnosed yourself correctly.
The problem you had is a part of High Alitute sickness.
High Altitute can cause serious problems especially if ascended rapidly.
It can also cause conditions like High Altitude Pulmonary Edema
(HAPE) & High Altitute Cerebral Edema
I would strongly suugest you that while ascending you should not ascend too fast.
you should give time to your body for 'Acclimitization".
Consult your physician next time you go for such activity, he/she shall prescribe you few medications for helping you acclimatize.
Dr Anshul, MD