Considering the iPhone 8 was released a year ago with 2gb of ram, I’d say anything with 3gb will be fine for quite awhile..
Historically, iOS updates have never been limited to RAM. They've always been limited by SoC. For example, iOS 12 requires an A7 or newer device.
I agree, the iPhone XR is the first single rear camera iPhone spotting 3gb of ram. Also seeing that it only has to render at x 2(same as 4 to iphone 8) due to the lower resolution display that it has, it probably would last for a long time to come. The 3 x render on the plus size iphones that is also featured in the X,XS, XS Max do require more ram, more processing power, more energy, more heat dissipation etc.
To give an extreme illustration, on a old computer system, games that run perfectly well on a 640 x 480 screen, might struggle on a 800 x 600 screen, and be totally unplayable if it was hook up to a 1920 x 1080 screen.
When we think of longevity, amount of ram, while being an important factor, is but one out of many factors.
Arguably the iphone XR could be considered the iPhone with the greatest longevity at the moment, simply because it requires less resources to render images on it’s display and yet it is equipped with the most current chip, the A12 Bionic.
In short this is probably the best value we are going to get out of an upgrade in terms of longevity. Kind of like the iPhone 6S when it was just release, only better.