You are certainly permitted to build compatible software and there is nothing in Copyright Law that prevents you from doing so. Ideas cannot be protected, only their expression in a particular software 'work'.
The same is not true of Patent Law. This protects an 'invention' and you cannot use a patented invention in anything without permission of the patent holder.
You should bear in mind that there could be considerable financial risk in doing this. Companies that have invested money in developing software are often prepared to invest money in lawyers to protect it, and finding out whether they are right or not can be very expensive.
The odd thing is: if you try and fail, they'll probably leave you alone. The greatest risk comes when you succeed.
If you head down this path then sooner or later you will need competent legal advice, and that also costs money. By all means give it a go, but be aware of the risks.
You might have thought that releasing the source code or even making it public domain would protect you, but it does not. Any legal action would be about the damage you did to a company by your actions and releasing the source code might even aggravate the situation.