Generally you should assume that yes, it will count as work in whatever country you're currently in, and doing it on a tourist visa is often illegal.
In practice it will depend on exactly what you do, and where. E.g. I used to travel to US a lot on the visa waiver scheme, and was briefed by an expensive US immigration lawyer on how to answer immigration questions out of concern that if I were to answer the wrong thing I might get turned away even without actually ever doing anything wrong.
In the US the general rule is that if you visit without a business visa, you can not do "productive work". That is, you can go to meetings and take instructions from your employer or a client, answer e-mails (but work you may need to do to be able to answer it may in theory not be allowed), or negotiate a contract, but you can't work on a project. In practice US immigration is pretty flexible as long as you're not taking the piss or give them reasons for concerns, and never overstay. Other countries can vary substantially - some will see you as an income stream for their country, others will see you as a nuisance, and treat you accordingly.
When it comes to taxation, you should assume that yes, you have to pay local taxes unless you specifically know otherwise. In most countries there will be a time threshold and/or a matter of what work you do, and often you won't be able to stay long enough or do work that incurs taxation on the most basic business visas anyway. 3 or 6 months is a common threshold before being considered resident for tax purposes, but tax liabilities can be incurred before you're considered resident some places. In many cases there will be treaties in place that regulates which country you should be taxing to if you're ordinarily resident - or a citizen - somewhere else.
If you're a US citizen, you have the added complication that the IRS considers its jurisdiction over US citizens as global, and so you need to check the situation before you do work abroad, as the absence of a tax treaty regulating income taxes can in the worst case mean you'll get taxed twice.
And yes, our laws were written for this manner of work. People have been travelling across borders to work for centuries. There's an extensive amount of treaties and case law dedicated to handling this, and large numbers of lawyers specialising on giving advice on how to deal with this.