... "legal agreements" signed under duress are pretty much by definition not legitimate.
Add to that, any "legal agreement" entered into by the Bajorian government likely did not
include slavery, interment camps, and stripping the planet of resources..
Plus sovereign entities (assuming Bajor was still consideed one) can exit agreements as they see fit. Usually with simple notification.
The Federation likely didn't just step in and end the Cardassian occupation because they themselves were engage in a long term conflict with the Cardassians. The Federation lacked the ability to make the Cardassian do anything at the time.
Very doubtful Starfleet had access to Bajor.