Why does DFT have only $N$ components?
The DFT is discrete in both time and frequency domains with the same number of samples in each domain, this means the input to the transform and the output of the transform are both discrete and both have $N$ samples. This is defined in the formula for the DFT where we have $N$ samples in time indexed as $n = 0$ to $N-1$ and $N$ samples in frequency indexed as $k = 0$ to $N-1$. The sampling frequency is located at $k = N$.
$$  X[k] = \sum_{n=0}^{N-1}x[n]e^{-j k \frac{2\pi}{N} n}$$
This is by definition, as for example the DTFT is continuous in frequency given by
$$  X(e^{j\omega}) = \sum_{n=-\infty}^{\infty}x[n]e^{-j\omega n}$$
As we see in the DFT formula, each sample $k$ in $X[k]$ is a correlation (sum of products) of the time domain waveform $x[n]$ with the frequency tone given by $e^{-j k \frac{2\pi}{N} n}$ -- observe that the form $e^{j\phi}$ is a phasor with magnitude $1$ and angle $\phi$, so we see that for each value of $k$ that we pick, $e^{-j k \frac{2\pi}{N} n}$ is just a phasor spinning at a different rate defined by $k$. This causes the correlation to maximize when $k$ is equal to or close to the frequency of $x[n]$.
The reason for $N$ samples is also quite intuitive since as the OP saw the transform mathematically behaves the same way as if the time domain waveform was periodic: This is similar to the Fourier Series Expansion (FSE) which decomposes any single valued analytic function into an infinite series of discrete frequencies, with each frequency an integer multiple of the fundamental, with the fundamental given by $f=1/T$ Hz where $T$ is the duration in seconds of the time domain signal: That makes sense as the FSE also behaves as if that time domain waveform continued to infinity as a periodic waveform; if we repeat an arbitrary waveform over $T$ seconds, it will have a fundamental frequency at $1/T$ Hz. It also must be discrete, since each of the individual components given by the higher harmonics will also repeat only over duration $T$, and we recreate the waveform by summing each of these component (so any component that didn't repeat over $T$ would violate our ability to do that).
Thus knowing we have $N$ samples in time, the fundamental frequency would then be at $1/N$.  We also know that the sampling rate is at bin $k = N$ in frequency, thus the fundamental frequency is at $k=1$, and there must then be $N$ total frequency samples (some may be equal to 0), each one the integer multiple of the fundamental, just like the FSE!