Find Power
To be in a position of power you must have options. "They" (your employer) have options, namely firing you, doubling your pay, demoting you, "constructive dismissal" (making you want to leave so they don't have to fire you), requiring your resignation, promoting you, or leaving you alone...and surely many more.
What options do you have?
I have a rule: Good decisions tend to be made from a position of power, while bad decisions tend to be made from a position of weakness. You have a potentially excellent CV right now, a prestigious title of Director, a history of progressive responsibility and managerial experience, great contacts, probably great reference potential from peers, subordinates, and hopefully at least certain supervisors, very current technology/stack experience...
You've got options. Get yourself into that mental space, instead of a reactive submissive one, and if nothing else you'll feel a lot better about what happens. Its ok if you don't feel that way - fake it.
Tap the Network
Time to call up your old friends, acquaintances, people you've done lunch with in the past, people you've met at conferences and get together, etc, and set up some meetings with recruiters and head hunters (at your level many, many positions never reach advertisements - as with all jobs, only more severely so).
Yeah, you are looking for the next potential career step. Right now. You have nothing to lose now, you are changing jobs anyway!
Get Things Straight
Once you've at least got yourself to faking confidence come what may, and you have feelers out to gauge interest in your next great thing you'll be doing, you can - if you want - set up a proper meeting with your current employers. Or just show up in their office, if your culture so inclines you - generally the better way to get real information anyway.
Then ask direct, clear, professional questions. Throw aside the emotions (again, fake it), and make sure what you think is reality is in fact reality. At least get some confirmation, if you don't already have it for certain, that you are in fact being asked to step down from a Director position to take a junior position.
In your personal case, you may already have what you need to go on. But the "grapevine" can send along some ridiculous info, especially from people who are in fact being pushed out for good reasons or purely political ones. Those facts may or may not apply to you.
Write Two Resignation Letters, Right Now
I say two, because if you are anything like me then you'll want to tell them to shove it and how they are making a huge mistake. Go ahead and right that letter at home - that one is just for you. You might want to print it out, file it, delete the file, empty the recycle bin, then if it makes you feel better set the paper on fire (in accordance with good sense and fire codes, naturally).
When you are done, write the simple one that says thank you and wishes them the best of luck on their future endeavors, but you are resigning from your position with the company.
In the end, remember that in a few months time this will be behind you and it'll all be over with it, so you'll just be a bit on edge for a bit. But then you'll be fine, regardless. This happens all the time, and everyone in a position of hiring authority understands that sometimes new de facto bosses push people out for purely political reasons.
Should You Take The Junior Position?
After making sure you really are being moved from a position of high authority to a junior member elsewhere, that decision would be up to you. You must evaluate it as a brand new job - would you be applying for such a job, even the reason for your being ousted from your current job aside?
If not, then I would strongly suggest a "thanks for the offer - but no thanks" approach.
Personally, I'd never actively advise someone take such a position, especially after 2 years in your current position. Right now you have a great story of what you've been working on - if you take the position your story changes to what you are currently doing as a junior, or how that great project you worked on was thought of so highly that they threw it out completely and moved you to a different team.
If you cut your history at the top, you leave with pride in a job well done even if management screws up after you left.
On The Bright Side...
After two years as director with a modern technology stack and a team under you, you are surely worth more and have more negotiating power now than you were when you got your present job. Lots of great stories of hard problems and how you tackled them, and the lessons your team learned in creating a real, complex software product, are fresh in your mind. Great interview material!
I would put your experiences up till before the project went on the chopping block in one box, the managerial/political mess in another box, and keep it that way. Don't let an unpleasant latter experience screw up your earlier, good experience. Be fair to yourself, and good luck on your adventures!