Before wagos were invented you used a junction box or connectors. Junction boxes were good because when you put the lid on you covered the exposed terminals, then nylon connector blocks came along and most just shoved them out the way, but there was no real/suitable small box to put them in available.
Wago now make a box (several) for wago connectors to be used them put in the box, then you should use a cable tie to "seal" the box.