can i connect these two objects at the red points on runtime from script? instead of using the pivot from the instantiated object without changing the pivot manually

You can either set the blue object as child of the object containing the red dot.
Or, you can make the blue object follow a specific point in the red dot object using the Update() method.