Do I understand correctly that I should simply save the collection of X objects like any other data in NodeBB, using its abstract data access mechanisms?
Yes, just use the db.setObject and other methods available, this ensures your plugin works on redis/psql/mongodb.
Can I expand the user data, topic, posts, etc. with an additional field in the database (probably containing the id of related X objects so that I can immediately ask about the right objects)?
Yes, some plugins like QnA do this and add solved/isQuestion fields into the topic objects.
NodeBB is very flexible in terms of data structure.