Self-medication = no-no. Simple.
In theory paracetemol, asprin or alka-seltzer should not be taken without medical supervision. The issue is very simple. A over-the-counter drug may have no or minimal side-effects in an earth bound environment. Sitting comfortably at 8,000 feet and then banging out at 40,000 feet may have totally unforeseen consequence.
I would hazard a guess that the pharacuteicals do not test drugs for extreme use unless requested by an authority.
You mention melatonin. Many years ago there were various trials to find a suitable drug that could be used as a sleeping pill. On issue was getting aircrew to sleep at odd hours or after high-stress activity. One such was Temazepan and another were Mogadon. Ideally they would put you out but allow you to be woken and become instantly alert. The latter was effective at putting you out for 8 hours and have minimal residual effects after that time. Unfortunately I believe it was assessed as adictive and the recovery period inside the 8 hours (2 pills) was not as rapid as they hoped.
Look at the Air Clues link and you will find the address of the AvMed people who will I imagine be delighted to help, Dr Stevenson in particular.