Removed an old florescent light from a drop celling and found this splice hiding

https://sopuli.xyz/post/43944703

If there are two hot wires for that it seems most likely they went to a switch at some point. I doubt what you have now would burn down the house anytime soon but putting them in a box is a good idea. If it was me I’d get circuit tracer and verify your hunch about them going to that old wall box. If they ended up not going there I’d just do the splice properly, shove it in a box and never think about it again.