Nuance, it's not a guy thing: women also do this. Start reading posts here and you'll see a lot of it.
As for why they do it, it's very simple: They are having trouble accepting it's over and are still trying to find a way to fix it. While it's true that they are disrespecting your boundaries, grief (yes, even for a failed relationship) can have a huge impact on someone's behaviour.
Look up the stages of grief.
Never regret anything that has happened in your life. It cannot be changed, forgotten or undone. So, take it as a lesson learned and move on.