Background index build on secondaries acquires a database lock in X mode and releases it at the beginning, scans the collection with IX lock, and acquires an X lock at the end. The first X lock is acquired by the background job but the running command waits for it, so it won't conflict with transaction operations. The IX lock plays well with transactions. However, the final X lock will cause problem on secondaries.
If the background index build completion is blocked by a prepared transaction and replication application on the same database is blocked by the background index build completion. That's a deadlock. The problem is similar to the 2-phase drop locking issue we've seen in