ESP8266 NodeMCU and MAX485: Data only sending in one direction

I notice that your wiring diagram does not match what you show in the photos.

Hello again, I would like to thank everyone for the discussion. I managed to connect it so that it works both ways, but I’m still not sure exactly why. Most likely, as you mentioned, the connections weren’t ideal. After reconnecting the system today, it suddenly started working.

sounds like intermittent connections

Like you show in your schematic or how you show in the photos or something completely different?

Like on schematic

RS485 also requires the grounds to be connected, like you show in the photo

I think there have been discussions about this before. Although the RS485 does state that, most transceivers do not require that. There is no need to use GND as a reference since the A & B pins reference each other (they switch polarity depending on a HIGH or LOW input)
This is of course anyway not a galvanic isolation, so you may as well.

for short distance the twisting of the pair and a terminator is not important, but for longer distance the twisting of the wires will create a magnetic field that counteracts the capacitance of the wires, increasing the possible length that can be used significantly. I think the modules have a terminator on them, although ideally there should not be one when the transceiver is in drive mode, but only at the receiving end.

Especially with this module OP has on the image. The ground pad next to A/B is part of some lightning protection circuit and supposed to be connected to PE.
I's not connected , neither to be connected to logic gnd.

For a reason.

Why not just do things the right way, according to the specification. That way you know that your RS485 system will always work correctly.

If it says you need a ground, then you need a ground, if it says you need terminations at both ends of the bus, then you need terminations at both ends of the bus.

Trying to do tricky things or bus structures that don't conform to the standard will just lead to troubles for you, especially for an inexperienced person.