The way I see this story is this:
1)This doujin (note that it was done on 2010), Alice was still in one-sided courtship with Marisa, while Marisa seemed too young to comprehend the need to love. And Shanghai(Alice's doll) had a very strong affection towards Alice, but couldn't express any of her feelings because she was a doll.
And in the end of this doujinshi, when Marisa took Alice and Shanghai to find a book about how to transform Shanghai into human, of course, in SDM, patchouli showed up, and told Shanghai that she knew what they were up to. Then Patchouli claimed that before they made it, she would have surely confessed her love to Alice, and made Alice her girl-friend.
While Shanghai was totally astonished, Patchouli left a suggestion that Shanghai could well have Marisa instead, when Alice became truelly unavailible
Then comes the second one:
http://dynasty-scans.com/chapters/touhou_blue_book_haruhakutai
Patchouli did successfully confess her love to Alice, and made Alice her girl-friend
Then the third one:
http://dynasty-scans.com/chapters/hoshi_utsuro
While Alice becomes really unavailible, and Reimu is already with Sanae, both Marisa and Shanghai become so alone. And at this point of time, Marisa also seems to have grown up a little to realize the need to find someone as a companion of romance, and begins to feel lonely. Therefore, these two somehow end up as a couple, just as Patchouli "predicted" in the first doujinshi of this storyline.
Of course that isn't perfect since Yohane grew as artist and storyteller during this years.