I've just realised that what I'm trying to do is completely flawed - when adding a new painting the node doesn't exist yet, so you can't get the artist and the artists paintings.
It might work if the user saved it first, but it's not very convenient.
The only way to do this properly would be with javascript, i.e. fire off an event once the user has chosen an artist to select the related paintings checkboxes.