Many other countries including UK enforce a similar rule. It's very inconvenient in those countries, but there's a significant difference: in most other countries that have this kind of policy, visas can typically be processed in a timely fashion (and are actually processed at all). It's insanely expensive and very arduous administratively to get a visa for the UK as the spouse of a British citizen, but the process will typically only take a month or so.
Isn't the Uk the opposite? There are many visas in which you have to be in the UK to apply. This is why we have people coming on boats, and why they are not illegal immigrants. They technically have to travel here to apply for aslyum, and since they do not have a visa cannot take conventional transport, but it is entirely legal for them to come here on a small boat as long as they present themselves to the authorities to claim aslyum upon arrival.
Graduate visa's are the same for example, where you cannot apply abroad, so you must be careful not to leave the country between graduating and getting that visa.