For now. They are well aware of the long picture. They know how long they can risk doing without maintenance, and will do it eventually. They are also well aware that EVs are coming and high fuel prices hurt them long term because people will switch and not come back.
Someone else suggested they see $85/bbl as the ideal price. I don't know if that is true, but it seems reasonable.
EV is committing irrespectively of what refineries are doing at this point. The latest Chinese models with a reasonable range are cheaper to manufacture than ICE cars. So I can see why refineries want to get as much money as possible now before the massive switch to EV.