The issue of finding or justifying the correct boundary conditions for the Schrödinger equation (or for the ordinary differential equations resulting from its factorization) is a never-ending story. Reasons like "wavefunctions must be continuous", "$\psi$ cannot diverge", or "it must go to zero because we expect zero probability" usually contain half of the truth but miss the real point and cannot go beyond the level of hand-waiving arguments.
The probabilistic interpretation requires only that, for a problem defined on a domain $D$ in $\mathbb{R}^n $, $|\psi|^2 $ would be integrable, i.e. it should belong to the Hilbert space $L_2(D)$. In $L_2(D)$ many of the elements are not even continuous and are allowed to diverge, provided their square modulus remains integrable.
The condition which puts a really strong constraint on the wavefunctions is the additional requirement of being in the domain of a self-adjoint operator. For differential operators, self-adjointness is quite a strong condition. Of course, the differential nature of the operator requires to restrict the domain to the subset of differentiable elements of $L_2(D)$. But it is the requirement of self adjointness which provides the real constraints on the boundary conditions. So, for example, the vanishing of the wavefunction at the boundary for the infinite square well, or the continuity conditions for a finite step-wise constant potential, all can be found and justified as condition to ensure the correct domain where momentum and/or hamiltonian operators are self-adjoint.
The case of the angular momentum is not different. The "periodicity" condition on the $\phi$ dependence of the wavefunction, when represented in spherical coordinate, is again consequence of restricing to elements of the subset of the differentiable function on $L_2[0,2 \pi]$ where the z-component $\hat L_z$ of the angular momentum is self-adjoint.
Finally, also $\hat L_x$ and $\hat L_y$, and then $\hat L^2$ put restriction on the boundary conditions on $\theta$, always as consequence of the self-adjointness requirement. It turns out (it is an exercise of integration by parts) that a logaritmic divergence of the wavefunction at $\theta=0$ and at $\theta=2 \pi$ (resulting from a value of A which does not terminate the series after a finite number of terms), although compatible with the square modulus integrability on the interval $[0,2 \pi]$, would not be compatible with the domain where $\hat L^2$ is self adjoint.
About the reasons and importance of being self-adjoint for QM operators I can rely on two references here on SE: Why is quantum mechancis is not content with symmetric operators, but wants self-adjoint operators? and What exactly implies the need of quantum mechanics for self-adjoint and not only symmetric operators?