Thank you for your answer @JColvin. Yes I am using an Arty A7 35T.
I do check all the commands I send or the response I get using a logic analyzer, and they all seem correct which validates the software end. I don't do any write operations to protected areas, furthermore my status register is all zeros which means all memory areas are unprotected. And as I said, what's really weird, is the flash works fine but once I write that register, it starts sending ones.
I am really stuck at this point because I don't have any ideas about further steps that should be done to debug the problem. I am thinking about writing the non-volatile configuration register directly, but I'm afraid the same problem happens and in that case turning off and on the flash will probably get it back to normal functioning.