I would suggest to update the model.DisplayDiscontinuedMessage one more time after the PrepareProductPriceModel(product)
model.ProductPrice = PrepareProductPriceModel(product);
model.DisplayDiscontinuedMessage = !product.Published && _catalogSettings.DisplayDiscontinuedMessageForUnpublishedProducts;
For example, we update prices every hour (from 3rd party API) and for that we overridden the GetFinalPrice in our Plugin.
If a product was unPublished and the new price switches the product to Published state user still see the "Products.Discontinued" message until another page refresh.