A standard argument to deny possibility of inserting dimensionful quantities into transcendental functions is the following expression for Taylor expansion of e.g. $\exp(\cdot)$:
$$ e^x = \sum_n \frac{x^{n}}{n!} = 1 + x +\frac{x^2}{2} + \dots\,.\tag1$$
Here we'd add quantities with different dimensions, which you have already accepted makes no sense.
OTOH, there's an argument (paywalled paper), that in the Taylor expansion where the derivatives are taken "correctly", you'd get something like the following for a function $f$:
\begin{multline}
f(x+\delta x)=f(x)+\delta x\frac{df(x)}{dx}+\frac{\delta x^2}2\frac{d^2f(x)}{dx^2}+\frac{\delta x^3}{3!}\frac{d^3f(x)}{dx^3}+\dots=\\
=f(x)+\sum_{n=1}^\infty\frac{\delta x^n}{n!}\frac{d^nf(x)}{dx^n},\tag2
\end{multline}
and the dimensions of derivatives are those of $1/dx^n$, which cancel those of $\delta x^n$ terms, making the argument above specious.
In this technique you can put all variables which you think will affect time. Here, Prof. has assumed that the time taken by apple to reach the ground may depend on $h$, $m$ and $g$. Let's see on what it depends, we already have as assumed,
$t \propto h^\alpha m^\beta g^\gamma $
$ \therefore t = c \; h^\alpha m^\beta g^\gamma \qquad \text{where} \; c \;\; \text{is} \; \text{constant} \qquad \dots \dots (1)$
Putting the dimensions of $ t, h, m, g$ in above equation,
$ [T^1] = [L^1]^\alpha [M^1]^\beta [L^1 T^{-2}]^\gamma \quad c \; \text{is dimensionless}$
$ \therefore [T^1] = [L^{\alpha+\gamma}][M^\beta][T^{-2\gamma}]$
comparing the powers, we get,
$ \alpha + \gamma = 0 , \quad \beta=0, \quad \gamma = \frac{-1}{2}$
$ \Rightarrow \alpha = \frac{1}{2} $
Putting the value of $ \alpha,\; \beta\; \text{and} \; \gamma$ in equation $(1)$, we obtain
$ t = c \sqrt{\frac{h}{g}} $
Here, you can observe, how mass is out of the equation. Similarly, dimensional analysis provides you the power to assume that a quantity $x$ depends on $y$ $z$ $\dots$ At the end you will be left out with only those quantities, on which $x$ depends.
Best Answer
Avogadros constant is not dimensionless. It is the number of atoms/molecules per mole. The mole is a substance unit which was introduced by chemists before the number of atoms/molecules per mole was actually known. The situation is similar to the arbitrary choice of the coulomb as a unit of charge which disregards the number of elementary charges it is composed of.
The number of particles is, indeed, dimensionless as long as you don't define it by the equivalent number of moles.