How Can DTTG Retrieve Documents in a Index-Only Database?

Yesterday I enabled the synchronization for an index-only database on my iPad. The database does not contain documents itself; it only indexes a directory under ~/Documents on my Mac, which in turn is synced with iCloud Drive. I didn’t expect DTTG to be able to open files within the database since they are not actually stored in it. Surprisingly, DTTG does open them with no issue. I also tried to make some annotations on a PDF and it was successfully synced back to the original copy in the iCloud Drive.

Of course, it‘s wonderful — but how can this be possible? Is it because both the documents and the database indexing them are stored in iCloud?

Even if you’re indexing files, the indexed data is synced unless you explicitly disallowed it. Since you’re using DTTG, you should not disallow this as you could never download the contents on demand.
Also, DTTG doesn’t support indexed files.