African country names are historically inaccurate, like Ghana. Benin was also partly in Nigeria (there's a Benin City in Nigeria) and Mauritania was named after the historical region of Mauretania, which is on the Mediterranean.
Yeah, it's possible that that area and some other parts of West Africa, such as present-day Ghana, were once generally called "Ghana", and after decolonization, British Gold Coast chose to call itself Ghana after its heritage.