How do I unpromoted existing node when new node is promoted to front page (Programatically)?
The settings for FrontPage is provided by default in Drupal 8. Because the Frontpage in Drupal 8 is a View, so it opens all kind of setting feasibility.

Hence if you go at Admin/structures/views you will find a view named FrontPage.

Hence, you just need to change the Pager setting. Change item 10 to item 1. 

And in sort criteria It is already Content: Author on (desc), so it will automatically will show new item first. So as you publish new item it will replaced and you have set item 1 in pager, so only 1 item will be shown on front page which is latest one.