Welsh government ministers were advised four years ago against merging three south Wales institutions, a BBC Wales can reveal.