I recently found out that every country in the world taxes its own residents, not only over the income gained in their territory, but worldwide as well, whilst I used to believe that taxes are imposed only by the government whose territory the income generates from. Are there treaties that avoid double taxation, in case a person works temporarily in another country? Or is the latter incumbent?
There are treaties that prevent double taxation, between some pairs of countries and not others. It's impossible to answer in general without knowing the two specific countries.
Even without double-taxation treaties, some countries have tax credits that may allow you to avoid double taxation. For example, the US has a Foreign Tax Credit, which can be used on income with a source in a foreign country that is taxed by both the US and the foreign country because the person is a US citizen or resident. It allows you to take a credit for the amount of tax paid to the foreign government on that double-taxed income, up to the amount of tax you would have to pay to the US for it; the net effect is you end up paying whichever of the two taxes is higher. This does not require any tax treaty between the US and that country. (The US also has the Foreign Earned Income Exclusion, which excludes up to ~$105k of foreign earned income from US taxes for people meeting certain conditions; this may be better than the Foreign Tax Credit, and the Foreign Tax Credit can be used for the remainder of the income that cannot be excluded.)
Every country is different. The USA is one of the few countries that think they have a right to taxes even if a US citizen lived abroad their whole life. Germany uses your world wide income to determine your tax rate (what percentage of your German income you have to pay in tax). Other countries have different rules.