If $X$ is a differentiable manifold, so that both notions are defined, then they coincide.
The ``patching'' of local orientations that you describe can be expressed more formally as follows: there is a locally constant sheaf $\omega_R$ of $R$-modules on $X$ whose stalk at a point is $H^n(X,X\setminus\{x\}; R).$ Of course, $\omega_R = R\otimes_{\mathbb Z} \omega_{\mathbb Z}$.
This sheaf is called the orientation sheaf, and appears in the formulation of Poincare duality for not-necessarily orientable manifolds. It is not the case that any section of this sheaf gives an orientation. (For example, we always have the zero section.)
I think the usual definition would be something like a section which generates each stalk.
I will now work just with $\mathbb Z$ coefficients, and write $\omega = \omega_{\mathbb Z}$.
Since the stalks of $\omega$ are free of rank one over $\mathbb Z$, to patch them together you
end up giving a 1-cocyle with values in $GL_1({\mathbb Z}) = \{\pm 1\}.$ Thus underlying
$\omega$ there is a more elemental sheaf, a locally constant sheaf that is a principal bundle for $\{\pm 1\}$. Equivalently, such a thing is just a degree two (not necessarily connected) covering space
of $X$, and it is precisely the orientation double cover of $X$.
Now giving a section of $\omega$ that generates each stalk, i.e. giving an orientation of $X$, is precisely the same as giving a section of the orientation double cover (and so $X$ is orientable, i.e. admits an orientation, precisely when the orientation double cover is disconnected).
Instead of cutting down from a locally constant rank 1 sheaf over $\mathbb Z$ to just a double cover, we could also build up to get some bigger sheaves.
For example, there is the sheaf $\mathcal{C}_X^{\infty}$ of smooth functions on $X$.
We can form the tensor product $\mathcal{C}_X^{\infty} \otimes_{\mathbb Z} \omega,$
to get a locally free sheaf of rank one over ${\mathcal C}^{\infty}$, or equivalently, the sheaf of sections of a line bundle on $X$. This is precisely the line bundle of top-dimensional forms on $X$.
If we give a section of $\omega$ giving rise to an orientation of $X$, call it $\sigma$, then we certainly get a nowhere-zero section
of $\mathcal{C}_X^{\infty} \otimes_{\mathbb Z} \omega$, namely $1\otimes\sigma$.
On the other hand, if we have a nowhere zero section of $\mathcal{C}_X^{\infty} \otimes_{\mathbb Z}
\omega$, then locally (say on the the members of some cover $\{U_i\}$ of $X$ by open balls) it has the form $f_i\otimes\sigma_i,$ where $f_i$ is a nowhere zero real-valued function on $U_i$ and $\sigma_i$ is a generator of $\omega_{| U_i}.$
Since $f_i$ is nowhere zero, it is either always positive or always negative; write
$\epsilon_i$ to denote its sign. It is then easy to see that sections $\epsilon_i\sigma_i$
of $\omega$ glue together to give a section $\sigma$ of $X$ that provides an orientation.
One also sees that two different nowhere-zero volume forms will give rise to the same orientation if and only if their ratio is an everywhere positive function.
This reconciles the two notions.
The original question:
Using a collar, one can show that if $f$ and $g$ are two isotopic diffeomorphisms of $S_g$, then the corresponding gluings are diffeomorphic. Is this also a necessary condition?
No, it is not. Suppose we have glued to obtain $M = X \cup_f Y$. Suppose that $X$ admits a self-homeomorphism $\Phi$. Define $\phi = \Phi|\partial X$. Then the map $g = \phi \circ f$ gives the manifold $N = X \cup_g Y$ and this is homeomorphic to $M$.
Now, it is simple to find such $\Phi$ if $X$ has compressible boundary - namely we can do a Dehn twist on a disk. You've ruled that out. But we can still find examples by twisting along an essential properly embedded annulus in $X$. For example, if $X$ is a twisted $I$-bundle over a non-orientable surface.
If you further assume that $X$ is "acylindrical" then there are still examples, but they are harder to find. We can build a hyperbolic manifold $X$ which has a self-homeomorphism $\Phi$ of finite order (eg Thurston's knotted Y).
If you further assume that $X$ (and $Y$) has no symmetries, then examples should still exist, but they will be very hard to find. Basically, we need to find a manifold $M$ that contains homeomorphic surfaces $S$ and $S'$, but where there is no homeomorphism of $M$ taking $S$ to $S'$. We then need to "get lucky" and find that $M - n(S)$ and $M - n(S')$ are homeomorphic and win. One way to do this is by a search through one of the many censuses of closed three-manifolds (eg snappy or regina). Another way that should work is to think deeply about hyperbolic three-manifolds with "corners".
Best Answer
What kind of object do you want to consider $M \# N$ to be, an oriented manifold, or unoriented? Presumably you're taking the connect sum up to some kind of equivalence. You'll also need for $M$ and $N$ to be connected if you want connect-sum to be well-defined in any sense.
In the oriented sense, $M \# N$ is well-defined up to orientation-preserving diffeomorphism, and contains both the punctured $M$ and the punctured $N$ as oriented submanifolds, so it depends on the orientations of $M$ and $N$ respectively.
As an unoriented object taken up to diffeomorphism, a connect-sum is well defined provided either input manifold has an orientation-reversing diffeomorphism.
Explicit examples where you can see there is or is not diffeomorphisms between such are connect sums of complex projective spaces (and/or their orientation reverses). There's also examples with $3$-dimensional lens spaces but working out which ones of those admit orientation-reversing diffeomorphisms is more work. All $1$ and $2$-manifolds admit orientation-reversing diffeomorphisms so there's no good examples there.
edit: in detail for $\mathbb CP^2$, the intersection form on $H_2(\mathbb CP^2 \# \mathbb CP^2)$ is definite, regardless of what orientation you give the connect-sum. But if you take the connect sum with one factor orientation-reversed $H_2(\mathbb CP^2 \# \overline{\mathbb CP^2})$, the intersection form is indefinite. For $3$-dimensional lens spaces, the torsion linking form is a good analogous invariant.
Have you looked at a book like Kosinski's Differential Topology? It covers these kinds of operations on manifolds.
If you want a lower-dimensional example that's easier to see, you could take the analogous connect-sum of knots in $S^3$. This is well-defined for oriented knots, but for unoriented knots you only get a well-defined operation when the knots are invertible, which means there's an orientation-preserving diffeo of $S^3$ that preserves the knot and reverses the orientation of the knot.