At first you pay taxes in the country the company you work for is registered (there might be b2b options, which might differ). Then you pay rest in the country where you have a tax residency.
In your example, at first you pay taxes in Germany and if Estonian taxes are bigger, you pay the difference there.
In your example, at first you pay taxes in Germany and if Estonian taxes are bigger, you pay the difference there.