Older home, a bit voodoo wiring

I have an older home with a bit voodoo wiring. Two lines are coming in a single gang box for whatever reason. My electrician jerry rigged the setup to make to Leviton Smart light the problem is that since the boxes dont have neutral wires, I had to rely onto Leviton Smart Anywhere Add on Dimmer switch which never could stay connected. Most likely because of all the interference from kitchen appliances. I got 4 Inovelli white (matter/thread) switches to test it out in the scenario. Has anyone have seen wiring like that? Down the line I probably need to take all the drywall out in the kitchen and the hallway to clean this wiring up.

The setup in a follows:

Switch location

  1. Bedroom location (single gang with two lines coming in)
  2. Main kitchen location (dual gang with three line coming in)
  3. Door location (single gang with one line coming in)

They control two lights

A) Hallway (3 way switch) Location 1 + 2
B) Kitchen (3 way switch) Location 2 + 3

Here are the photos:

Any ideas how to make it work? Thank you and Happy New Year.