Adjust logic that adds self references for inline schemas

Fixes #61