It is not just attention-seeking that can cause soiling.
Being distracted until it is far too late, especially if his bowel and anus give him little warning of the impending need to visit the lavatory. Not everyone receives the same signals from their body and it is possible his bowel spasms before he feels the pressure.
Embarrassment is another factor. People are so used to visiting the lavatory without explanation and probably locking themselves in it sends mixed messages to youngsters.
Hard white porcelain and violent splashing sounds can be scary to small people.
Perhaps he is trying to retain his stool and failing. Stool retention is related to a different set of problems I have little experience of.
I suggest you and your boyfriend begin a new era of openness about visiting the lavatory to pass a stool.
I suggest you don't get upset with him but you try and get him involved with laundering his own underwear by hand.
The use of nappy liners would help prevent it sticking quite so much...
I suggest you observe him closely and remind him when it is time to take a dump. There are almost always signs.
Peer pressure is a valuable aid to changing the behaviour of children.
The carrot-and-stick approach remains the best way of manipulating people, even children. It is finding the right carrot and the right stick that presents the difficulty.
Good luck!