Is there a way to enable the ringer/notification sounds only when using headphones?
I don't have Android Marshmallow but following apps can easily achieve the goal on Android Lollipop 5.1. Should not fail on your OS, I believe. Let me know the result in any case.

MacroDroid

When headphones are plugged:


Trigger: Headphones Insert/Remove &rarr; Headphones Inserted
Action: Volume Change &rarr; select Notification and Ringer, and configure the slider for the level of volume you want


When headphones are removed:


Trigger: Headphones Insert/Remove &rarr; Headphones Removed
Action: Volume Change &rarr; select Notification and Ringer, and keep the slider to 0


Automate

It seems to work too. Your flow should look like this:

(Click image to enlarge)



Relevant blocks:


Interface &rarr; Wired headset plugged?
Settings &rarr; Ringer mode set


The said flow would cause the ringer and notification volume to come back to the level you set them to, before switching the phone to vibration.

Atooma

It worked as well. However, it appears to not been updated since May 2015.

When headphones are connected:


IF: Headphone &rarr; Plugged 
DO: Audio Manager &rarr; Set ringer volume &rarr; configure the slider
DO: Audio Manager &rarr; Notification volume &rarr; configure the slider


When headphones are removed:


IF: Headphone &rarr; Unplugged 
DO: Silent mode &rarr; On &rarr; Vibrate: Yes


Droid Automation

It also worked well for me.

Instructions:


Profile: Headset plugged


Trigger: Headset state &rarr; Becomes plugged  
Task: Sounds &amp; Media &rarr; Volume: Ringtones &rarr; configure
Task: Sounds &amp; Media &rarr; Volume: Notifications &rarr; configure

Profile: Headset unplugged


Trigger: Headset state &rarr; Becomes unplugged
Task: Sounds &amp; Media &rarr; Volume: Ringtones &rarr; configure to zero