I'm not sure why @Spencer didn't post this as an answer, but I believe he is correct in his comment from Apr in 2018 (as is the more recent (June 2018) limited response from @Rob Crawford):
There is another snippet from the Madrid Skylitzes showing this same
thing on land, on top of a hill, while the boat rows away, depicing
Thomas the Slav fleeing to the Arabs. Link – Spencer Apr 11 '18 at
The referenced manuscript has the following image on pg 68 (of the pdf):
It appears that the OP is correct in the original query,
behind or on the ship...
and that this structure is actually behind the ship in the original image (pdf page 78). If you go through the illuminated manuscript there are numerous images of land based scenes showing very similar representations for buildings.
A scene from the page before the depiction of Greek fire, showing more building representations :
... and another several pages after, showing the building not on the ships:
It seems pretty conclusive this structure is not part of the ships, but in fact is representing structures on shore. We can see crenellations on one of the buildings depicted above, differentiating a military structure, and many of the images show crosses on top to specify religious buildings, so the lack of any of these identifying features means the best we can say is that this represents a generic structure.
One other thing that can be observed from the manuscript itself, is that among the many other representations of ships within this document, I have found (so far) no others which show this structure on a ship. This adds to the conclusion that it represents a building on land. If it represented a common part of a ship, it should be represented as such elsewhere within the manuscript.
The entire illuminated manuscript can be viewed and downloaded at World Digital Library