Strongly simplified example:
convert logo: ( -clone 0 -bordercolor green -border 10x10 ) +append test.png

As far as i understand, the operation
( +clone +clone -compose subtract -composite +delete )
may be pointless, but should not change the result.
The last image in the stack is cloned twice, both copies are combined in one composite, and this composite is deleted, resulting in no new image on the stack
However:
convert logo: ( +clone +clone -compose subtract -composite +delete ) ( -clone 0 -bordercolor green -border 10x10 ) +append test.png

The exact result depends on the last -compose operation:
convert logo: ( +clone +clone -compose multiply -composite +delete ) ( -clone 0 -bordercolor green -border 10x10 ) +append test.png

Update: -respect-parenthesis prevents this weird behaviour, so I am not sure if it is a bug after all.