I am a German citizen permanently living in Germany. Is it legal to be employed by a company located in Mauritius and work 100% remotely without ever visiting Mauritius?
Under German law, yes sure. As long as you keep to all regulations.
You have to declare your taxes. This is income, whether it comes from inside Germany or not and whether it is paid into a German bank account or foreign.
You have to have a health insurance and likely need to pay into the social security and pension funds. As your employer most likely does not do this for you as a German employer would be required to, you will need to pay both the employee and the employer's part yourself.
So yes, if you pay your taxes on it and have health and social security insurance, Germany does not care where the money comes from.
Now whether the company in Mauritius is legally allowed to hire and pay you under their law? I have no idea.
Please note that filling out all the right forms correctly is not for the faint of heart. And finding out that you did it wrong only years later is painful and costly. Also calculate your costs before you do anything. Paying both parts for your health insurance for example can easily be up to 400€ a month more then a German employee at a German company, so run your numbers. You may be better off being officially self-employed or even incorporated. Just because it's legal, does not mean it's a good idea. Hire a professional to advise you on the economic and bureaucratic side of this.