Unable to merge partitions or reinstall OSX
You've probably booted the recovery system from the recovery partition of the partition you're trying to merge/delete, so the recovery partition is getting in the way of repartitioning.

How I'd handle this situation depends on whether you've got another Mac and an appropriate macOS installer app handy.

Assuming this is your only Mac, as a safety net, I'd install macOS to an external drive of some kind. A spare USB HDD, or a large enough flash drive (USB stick, SD card, etc.) will do the trick - 32GB is plenty, 16GB is in theory enough too but I'm not sure the installer will allow it. Then I'd boot from that external OS instance and download the macOS installer app from the App Store, or check that the external OS has a working recovery environment. Wipe the internal drive - if Disk Utility won't cooperate, use the command line equivalent: diskutil erase (after checking the disk number, e.g. disk0, using diskutil list).

The macOS installer should now make the freshly erased internal SSD available as an install target.

If you've got another Mac and an appropriate cable handy, the easiest solution is probably creating a macOS installer flash drive using the other Mac and then booting that installer on your MBP. You can then erase the disk using either Disk Utility or diskutil from the installer environment's Terminal, and select the freshly erased disk in the installer.