I'm not sure if such an elliptical orbit would be possible while still classifying them as planets and not dwarf planets though.
EG https://astronomynow.com/2019/08/28/exoplanet-found-in-unusu...
Intuitively, if the two planets have orbiting periods that are not basically identical, then after long enough they will also have long stretches of time where they are on opposite sides of the star (with a slight caveat if the periods are rational multiples of each other, but in either case their positions will be asymptotically uncorrelated). On the other hand, if they are close and have the same period, I'd expect their gravitational pulls would eventually merge them together unless they become a binary planet system.
But I have no physics/astrophysics background so this could easily all be stupid.
This is why objects in geostationary orbit can only exist at a particular distance from the earth: https://en.wikipedia.org/wiki/Geostationary_orbit