There are ways to glue while preserving positive Ricci curvature, but of course they require some geometric control near $\partial M$. Let me mention two relevant papers:

On the moduli space of positive Ricci curvature metrics on homotopy spheres by D. Wraith.

Construction of manifolds of positive Ricci curvature with big volume and large Betti numbers by G. Perelman.

For example, Perelman shows how to glue two positive Ricci curvature manifolds with isometric boundaries to get a positively Ricci metric, which requires (roughly speaking) that the normal curvatures at one boundary is greater than the negative of the normal curvature at the other boundary when the normals are chosen correctly, like in filling a cylinder with a cap.

There are also obstructions to such gluings. For example in

[MR1216628, Greene, R. E., Wu, H. "Non-negatively curved manifolds which are flat outside a compact set". Differential geometry: Riemannian geometry (Los Angeles, CA, 1990), 327–335,
Proc. Sympos. Pure Math., 54, Part 3, Amer. Math. Soc., Providence, RI, 1993]

one find the following: If $M$ is a complete Riemannian manifold of nonnegative Riccie curvature which is flat outside a compact set and is simply-connected at infinity , then $M$ is flat.

For example, $\mathbb R^n$ is simply-connected at infinity when $n>2$, so if you replace a round disk in $\mathbb R^n$ with a compact manifold with sphere boundary, and hope to have nonnegative Ricci curvature on the result, then the result must be flat, and in particular, be finitely covered by the product of a Euclidean space and a torus.

Note that a capped $2$-dimensional cylinder is not simply-connected at infinity, while a capped $n$-dimensional cylinder ($n>2$) is not flat outside the cap.