There are several way to inject these meta-markers:
# hard-code knowedge about the respective markers into the serializers
# make the serializers depend on MediaWiki API code
# inject a callback for post-processing substructures, which could be used to inject the meta-markers.
# use a decorator to post-processing substructures, to inject the meta-markers.
# post-process the complete data structure representing an entity, injecting the markers in the appropriate places
See also: https://github.com/wmde/WikibaseDataModelSerialization/issues/53