There is a similar rule in Ontario, but it doesn’t apply to buildings built after 2018.
This exemption was put in place as an incentive for more rental units to be put on the market (or to enrich developers and landholders, depending on your political stance).