Source Rule states that income to be taxed in the country where it originates from irrespective of whether the income accrues to a resident or non-resident.
Residence Rule states that the income should be taxed based on the country in which the taxpayer lives/resides.
If both rules apply at the same time to any business entity, it would lead to suffering taxes from both ends and functioning of business at an International scale would become prohibitive and discouraged. This is where DTAA's come in to protect adverse effects on trade and movement of capital globally and avoid prohibitive burden on taxpayer. Domestic laws of most countries mitigate this issue/address this problem via unilateral relief with respect to such DT under Section 91 which allow a resident who has already paid tax on an income accrued outside India (With which there is no agreement under S90) based on the laws of that country to be entitled to deduction under Indian Tax law for that part of the income for which tax is already paid. Tax treaties help in removing tax obstacles and encourage movement of capital and improve investment climate between countries. These DTAA's are negotiated under Public International Law and are governed by Principles laid down in Vienna Convention on law of treaties. It's every nations duty to look out for citizens so they don't pay tax twice on the same income (once in country of R and then in Country of A) but also enough precautions need to be taken to make sure there is no Tax Avoidance and remedies for tax