This is unfortunately the nature of testnet4, it has blocks with high difficulty (around 10^10) followed by a lot of minimum difficulty blocks (difficulty == 1), which creates a lot of branches.
High-difficulty blocks appear roughly every 5-50 blocks, so you may occasionally lose a transaction if it ended up in an orphan branch.
Example picture with high-difficulty blocks (dark blue) and 1-difficulty blocks (light blue):
