How can one think of any such alliance in their current state. Both countries have played into the hands of religious fanatics, given all kinds of support to armed terrorists and these groups have now grown so big that their masters are not able to control them.
Pakistan and Bangladesh are failed States. There are no easy solutions for them. They need to shun the extreme religious views, become secular republics, go for modern education, and CRUSH all terror elements ruthlessly and immediately.