Replacements are not going to be discontinued for a while, although there is no guarantee of how long it will still be available. Apple guarantees repair/replacement availability for at least 5 years after the last date that a device was manufactured. However, there are still replacements available for the iPhone 6s and 5c, which are considerably older than that.
However, the replacement isn't going to be a new retail device, so whether or not the retail version is discontinued doesn't matter. It's going to be a replacement device (model number modified to start with "N") that comes in a plain box (no graphics) and no accessories. The photos I've seen show that at least some come in a box that says "iPhone Apple Service" in red lettering.