you refer to stamp duty, therefore by implication your properties are in England (not Wales, Scotland or N Ireland). I will assume that if you are married then your spouse lives with you (if not the scenario is more complex)
you wish to sell your current PPR and occupy an ex-rental as your replacement main home
As you understand, that does not involve the purchase of an additional property so, as you acknowledge, there is no SDLT implication on that change of home.
you then wish to purchase a new ("replacement") main home whilst retaining the ex rental/ex main home after having sold the original main home
The key factor in your case is one of timing
In order to meet the criteria for replacing a main home, and thus avoid having tol pay higher rate SDLT, the new main home must be acquired within 3 (calendar) tears of the completion date of the sale of the old main home.
As your occupation of the "ex rental" is nothing more than a stepping stone between sale of old home and purchase of now home, that ex rental is completely ignored. So the fact your have gone from owning 3, to owning 2, to owning 3 is assessed against the acid test: have you replaced a main home: Yes or No?
Subject to the 3 year rule, your plan would meet the criteria for having replaced a main home and therefore you would NOT be subject to higher rate SDLT
Your scenario is covered by example 4 which affirms that the SDLT higher rate is NOT APPLICABLE
SDLTM09810 - SDLT - higher rates for additional dwellings: Condition D - further examples - HMRC internal manual - GOV.UK