The trick to spreading pain upwards without getting fired is to communicate the situation upwards, repeatedly, ahead of time. “Hey I think that artificially imposed 6 month deadline is unrealistic”. “We’ll see”: Closer to the date: “That deadline is coming up fast. As I mentioned a couple months ago, I think we’re making good progress but I don’t think we’ll hit the deadline with the feature set we’re building. I think we need to cut features, push back the deadline or all start working crazy, unsustainable hours. And that’s not a precedent I’d like to start. What do you think boss?”. Etc.
If they don’t change anything, don’t suddenly pull all-nighters to then meet the deadline. A bad timeline was never your mistake to fix. And assuming you’re a productive member of the team, you’re not going to be fired for helping management plan like this.
Which is basically what you've written. This concept should be discussed more often.