Extended international travel is certainly a problem for those on critical or uncommon meds. The standard "90 Day Supply" setting a maximum for most, unless you want to pay out of pocket to possibly get an additional supply. As for traveling with a larger supply, if questioned, and with proof of a longer stay, it is likely they will relent and let it go. Certainly review rules and regulations and suggestions, but their main issue is smuggling, many of the rules are guidelines to show otherwise rather than "laws". Some countries (Asian ones come to mind) are very strict, requiring preauthorization to bring in even a normal supply of some common meds for a short trip.
Getting meds there is an option, but kind of a mine field for the beginner. First you have to research if the drug you take is even approved for sale where you will be, if it is sold under a different name, or available as a generic. Then you will need to find a doctor, make an appointment, and have information for him. A letter from your doctor stating his diagnosis based on test results, what he prescribed, and the dose would go a long way, some common meds, maybe just a copy of the prescription and you explaining why you take it, may be enough. In extreme cases, they may want some tests before granting a prescription. It may be risky though to just assume you will get a prescription if needed. I would probably take the chance with the 2 meds I take, for example the Statin, it is common, and worse case, if I have to go without, it will not severely affect my health. Other meds that is not the case, a sudden stop of the medication, or your condition can cause real problems.
There is also the issue of different standards of care between countries. This came up during Covid and the use of Paxlovid. It was handed out like candy in the US, in most of the EU it was reserved for only the most severe cases. You may have difficulty convincing a doctor of your need for semaglutides for example, and pretty much forget about getting opiates/opioids, as well as some anxiety/depression meds. The end decision is up to the doctor there, and their judgement. Of course everything will be paid out-of-pocket, with you fighting for reimbursement.
For longer term residents/ex-pats, there is another layer, then it may be possible to set up regular refills, even import or get available specific meds not normally available, but not for the casual traveler.