Hello again everyone,
I think I might have a found a solution, like Braden Brook said, it has to do with the usb ports at the back.
I was browsing through the system setting and found that there is an option for turning off devices attached to the usb ports, I'm guessing this includes the ones at the back of the Display as well.
So I went on setting the "turn off" feature for the usb ports as "never". So in theory the current that's keeping on all the usb devices should never stop, consequently preserving the connection between the macbook and the display.
This is also the reason why when waking up the macbook it would say that devices where unsafely disconnected.
The option for this can be found in energy settings, and turning off the "put hard disks to sleep when possible". I did this for both power and battery, as when i go to sleep i usually disconnect the power of the macbook pro.
Hopefully this will work and thank you all for the replies! 😀