It’s worth speaking (nicely) to your bank for things like this. I’d have refunded you, provided I could verify the facts (ie seen the regular payment and that this one was late). And when I was in BACS I’d have told our branches to do the same. But there’s no obligation, it’s pure goodwill. And yep build in some margin in your timescales.
I used to work in the BACS desk of a big bank, and this sort of thing was fairly common- mostly just human error at the company. If there’s any legal obligation, I’d expect to have heard about it and I never did. But then we were quite a bad bank 😉
If nothing else, the company could have let you know there was an issue- if they didn’t know about it before the day the money was due in your account, they’re incompetent.