Maybe, maybe not. According to FIFA:
A player in an offside position is only penalised if, at the moment the ball touches or is played by one of his team, he is, in the opinion of the referee, involved in active play by:
interfering with play or
interfering with an opponent or
gaining an advantage by being in that position.
So, if the defense steps up, the guard players (those in front of the ball) are in an offsides position, the ball is being touched by a teammate, but they are really no longer interfereing with play or opponent or having anymore advantage as the defense has left them alone.
As long as the front guards stop and get behind the ball before they can interfere or distract the keeper on a shot or breakaway, I don’t think you can call them offsides.
The best way for the defense to set up this offsides trap is to back in close to the goal before suddenly stepping up, therefore the guards will be immediately shielding the keeper and can be called offsides.
Its all about the timing and location on the field.