That's the wrong question. It assumes there is an upside. But the real question is: what is the downside of not defending Ukraine? and what is the downside of defending Ukraine? Because war doesn't really have an upside, it only has downsides.
Putin thinks there is an upside - It will deter west from integrating Ukraine into NATO. In a way this makes sense. West just don't want to deal with a Russian headache like this.