Solution:
In the main branch under dataset we found a sink file which was referring to the deleted pipeline name. It was also deleted and then the tick on the pipeline validation occurred immediately.
So the problem is if we delete any pipeline using devops file system we should make sure all files are deleted else this error occurs while publishing.
Thanks.