No, not directly. But you can lose your job for taking excessive time off, even with a doctor's note. But for most reasonable companies, we're talking several months, not weeks here.
See it from their point of view: what is the point of employing someone who (for example) has been off work for 9 of the last 12 months? OK, it doesn't cost them directly if you don't get sick pay, but it does cost them in overheads and by you not being at work, as someone else has to do your work.
I think what your company is doing is just covering itself, so if you take lots more time off in the future they have a documented history of the warnings they've given you.
To be honest, annoying though it is, I wouldn't worry about too much at this stage.
Legally, no, there isn't anything you can do.