It’s a niche thing you’re trying to do, and likely not seen code that does that, thus it can’t help … it can’t actually think its way around it.
It's not necessarily niche either. The codebase already does this all the time. I just can't figure out why it won't do it for me.
FWIW, at least 80% of my time in writing software for an R&D laboratory is devoted to solving problems like this.