We were very tempted to get insurance before the border with Senegal for the reason you stated and we'd been told that the first Senegal police stop asks to see your insurance... which he did!
However, we went to two different insurance places when we were in Mauritania and got quotes. The second insurance company told us that it was very highly priced as it was not for the country we were in and that we would be better off buying it in Senegal!! As both quotes were very high we decided to see what it was like at the border... in case anyone's interested it was over 230 Euros for a Unimog for 3 months covering most of West Africa.
We arrived at Diama and saw the nice lady behind the customs office on the Senegal side and bought exactly the same insurance for 90 Euros - remember this is a Unimog and for 3 months.
Hope this helps