Dynamic Time Warping of inverted binary signals
I had a similar experience, i had to align side channel traces, I've tried to implement my own DTW that do lot of things not only aligning, but the this method was extremely slower than separating the processing and DTW.   

So if you are using python the FastDTW will do the job insanely quicker than any handmade DTW, so the laborious way is the quickest way to get the aligned signals, besides that on very large signals DTW need huge amount of memory, so separating the two process is in my experience is the best solution.