I'll start with the case $n = 4$ below, and further down I'll touch on the generalization to arbitrary $n$.
The case $n = 4$ (square)
This is building upon the answer by Jens for the square, and upon the strategies provided in the linked Google discussions topic. It does not provide a full answer yet but aims to give sharper bounds on $v(n)$.
Terminology: as depicted below, we consider a regular $4$-gon or square (for now) with side length $2$. The teacher moves along the edge at speed $v$, the boy moves in the interior at speed $1$. As already described by others, there is a small region in the middle where the boy can move in such a way that he can always make sure that the teacher is at the far opposite end, i.e. such that the center is on the line between the boy and the teacher. For this inner region we can take various shapes.
Attempt 1: Inner circle
Let us first consider the case where the inner region is a circle of some radius $r$ as depicted below. For the case the pool is circular, this choice was optimal as described somewhere in this topic.

Now, to see what the radius $r$ is, we basically need to make sure that moving along the perimeter takes as much time for the boy as moving along the edge of the pool for the teacher. The circumference of the circle is $2 \pi r$, the pool has a perimeter of $8$, and equating these, taking into account the velocities, gives $2 \pi r = 8 / v$ or
\begin{align}
r = \frac{4}{\pi v}
\end{align}
Next, although the boy can keep the center between him and the teacher at all times, he cannot force the teacher to make a choice as to whether the teacher waits at a corner for the boy to exit this region, or sits at the middle of the edge, or anywhere else along the edge. We will analyze two specific cases similar to Jens (middle of edge and corner), but note that one would have to consider the teacher being on any point of the perimeter of the square to show that he can never catch the boy. On the other hand, the corner and center of an edge intuitively feel like "extreme" cases and one of them is likely the best strategy for the teacher.
Case 1: Center of an edge
The easy case, and the case where we mostly improve upon Jens' analysis with an inner square instead of an inner circle. In this case the teacher patiently waits at the center of one of the edges until the boy exits the inner circle, after which the teacher goes after him. A straightforward strategy now is to just make a run straight for the edge, and see if it works. At the boy is already at distance $r = 4 / (\pi v)$ from the center, he still has to traverse $1 - r = 1 - 4 / (\pi v)$. The teacher has to go half the perimeter to make it to the other side, in time $4 / v$. So the boy gets away if
\begin{align}
1 - \frac{4}{\pi v} < \frac{4}{v}.
\end{align}
Solving for $v$ leads to $v < 4 + \frac{4}{\pi} \approx \color{blue}{\mathbf{5.27}}$, so in this case the boy "survives" if the teacher is no more than $5.27$ times faster than the boy.
Case 2: The corner
The hardest case to analyze. We follow the boy strategy outlined by Jens: run towards the opposite corner, and as soon as we hit a point where the closest point on the boundary would be the mirrored opposite of where the teacher is at that point, we make a run for it straight towards the boundary.

As in this figure, the boy starts at the point $(-r/\sqrt{2}, -r/\sqrt{2})$ and the teacher starts at point $(1, 1)$ if we take the center of the pool as $(0,0)$. The boy swims straight towards $(-1, -1)$, until at a certain point $A = (-R/\sqrt{2}, -R/\sqrt{2})$ at some distance $R$ from the center, when the teacher is at the point $B = (1, R/\sqrt{2})$. This occurs at time $t_1$, satisfying the following equalities in terms of the distance/velocity traversed by the boy and teacher:
\begin{align}
t_1 &= (R - r) \cdot 1, \\
t_1 &= \left(1 - \frac{R}{\sqrt{2}}\right) \cdot \frac{1}{v}.
\end{align}
Then, from this point on, the boy has a distance $1 - R/\sqrt{2}$ to traverse towards the edge, while the teacher (who is at the far opposite end) has a distance $4$ to traverse. So after $t_2$ more units of time, the boy escapes if:
\begin{align}
t_2 &= \left(1 - \frac{R}{\sqrt{2}}\right) \cdot 1, \\
t_2 &< 4 \cdot \frac{1}{v}.
\end{align}
From the second set of equations we can solve for $R$ to obtain $
R > \sqrt{2} (1 - \frac{4}{v})$. (If $v < 4$ then clearly the condition is always satisfied, so only $v \geq 4$ is interesting.) Solving the first set of equations for $v$, plugging in the bound on $R$ and $r = 4 / (\pi v)$, we obtain:
\begin{align}
\sqrt{2} \left(1 - \frac{4}{v}\right) - \frac{4}{\pi v} < \frac{4}{v^2}.
\end{align}
Solving for $v$ leads to $v < \frac{\sqrt{2} + 2\pi + \sqrt{2 + 4 \sqrt{2} \pi + 2 (2 + \sqrt{2}) \pi^2}}{\pi} \approx \color{blue}{\mathbf{5.42}}$, so the boy gets away if the speed of the teacher is no more than $5.42$ times the speed of the boy.
Preliminary conclusion
Based on these two cases, one might hope that for the square, the velocity needed for the teacher to catch the boy using any possible strategy is at least
\begin{align}
\Large\boxed{v(4) \stackrel{?}{\geq} 4 + \frac{4}{\pi} \approx 5.27},
\end{align}
where the best strategy for the teacher based on our particular strategy for the boy would be to wait at the center of an edge. To prove this, however, one would also have to consider cases where the teacher waits at some other particular point along one of the edges until the boy leaves the inner circle. As argued before, the two considered cases may be the "best" strategies for the teacher, so one might hope that in those other cases the teacher needs a velocity $v \geq 5.27$ as well to catch the boy.
Attempt 2: Inner diamond
From the above analysis, we note that the boy is more resistant against a teacher starting in a corner than a teacher starting at the middle of an edge. This suggests that the optimal "inner shape" should actually be more "pointy" down in the middle, so that the boy gets a further head-start when going straight for the edge, at the cost of starting a bit further from the corner when the teacher is in the opposite corner. So as an alternative, consider an inner shape in the form of a diamond, like below.

Now as before, the perimeter of the inner region should be a factor $v$ smaller than the perimeter of the outer region, hence the edge length $2/v$. We now again consider the same two special cases, hoping that other cases in between are worse for the teacher. The figure again depicts the boy's strategies for both these cases, similar to the circular case.
Case 1: Center of an edge
In this case, the boy starts at distance $\sqrt{2}/v$ from the center, and distance $1 - \sqrt{2}/v$ from the edge. When he makes a run for it, he succeeds if $1 - \sqrt{2}/v$ is less than $4/v$, the time it takes the teacher to run around the pool. This leads to the condition on $v$ of $v < 4 + \sqrt{2} \approx \color{blue}{\mathbf{5.41}}$.
Case 2: The corner
We can reuse the previous analysis for the circular inner region, where the boy now starts at a radius $r = 1/v$ from the center, rather than $r = 4/(\pi v)$. Note that the boy is now closer to the center, and so we expect the teacher to have a better chance of catching the boy.
Redoing the same analysis, we get the following condition on the value $v$ for which the teacher is just in time:
\begin{align}
\sqrt{2} \left(1 - \frac{4}{v}\right) - \frac{1}{v} < \frac{4}{v^2}.
\end{align}
This has a solution at $v = \tfrac{1}{4} (8 + \sqrt{2} + \sqrt{66 + 48 \sqrt{2}}) \approx \color{blue}{\mathbf{5.25}}$. So indeed, the teacher needs a slightly lower speed to catch the boy.
Based on this analysis, the teacher would wait in a corner, and only need a velocity of $v \approx 5.25$ to catch the boy. This is slightly worse than the circular inner region, which required the teacher to have speed $v \approx 5.27$.
Attempt 3: Inner octagon
The above two cases still seem suboptimal: ideally we would like to balance the two cases to get the best overall complexity. (Note however that again, there is no proof that the best strategy for the teacher is one of these two - the best strategy for the teacher might be to sit at 3/4 of an edge for instance. This is just to simplify the analysis.) To at least balance the two complexities, consider the case where the inner shape is an octagon.

We denote the bottom point of the octagon by $(0, -y)$ for $y$ to be determined later, and the left bottom corner by $(-r/\sqrt{2}, -r/\sqrt{2})$ again for $r$ to be determined later. Now, based on the perimeter condition, the edge case and the corner case, we obtain three equations (technically inequalities) on the parameters $y, r, v$:
\begin{align}
8 \cdot \sqrt{\frac{r^2}{2} + \left(\frac{r}{\sqrt{2}} - y\right)^2} &= \frac{8}{v}, \\
1 - y &= \frac{4}{v}, \\
\sqrt{2} \left(1 - \frac{4}{v}\right) - r &= \frac{4}{v^2}.
\end{align}
This is pretty messy, but can be solved for the three variables, leading to:
\begin{align}
y &\approx 0.256023,\\
r &\approx 0.223696,\\
v &\approx 5.376512.
\end{align}
In other words, if we simply balance these two cases, the boy can escape teachers sporting a velocity of $v \approx \color{blue}{\mathbf{5.38}}$.
Conclusion
Below is an overview of the velocities required for the teacher to catch the boy, for different inner shapes, and for different starting positions.
- Inner shape: Square (see Jens' answer)
- Edge center: $5.00$
- Corner: $5.51$
- Minimum $v$: (at most) $\color{blue}{\mathbf{5.00}}$
- Inner shape: Diamond
- Edge center: $5.41$
- Corner: $5.25$
- Minimum $v$: (at most) $\color{blue}{\mathbf{5.25}}$
- Inner shape: Circle
- Edge center: $5.27$
- Corner: $5.41$
- Minimum $v$: (at most) $\color{blue}{\mathbf{5.27}}$
- Inner shape: Octagon
- Edge center: $5.38$
- Corner: $5.38$
- Minimum $v$: (at most) $\color{blue}{\mathbf{5.38}}$
Again, I'd like to stress that (1) these are not proven until every single starting position for the teacher has been analyzed, and (2) these still may not be the best strategies for the boy.
Better strategies for the boy
As outlined in the Google discussions topic, the optimal strategy for a circular pool involves an ever-updating strategy for the boy, moving along an arc towards the edge of the pool. Similarly one would expect that here, the path for the corner-case may not be optimal, and a smooth curve may lead to better results. When running straight for the edge, moving along an arc seems less tempting; the time lost by the boy will likely be larger than the extra time needed for the teacher to run along the edge.
Furthermore the analysis is now based on various different inner shapes, which were kind of chosen ad-hoc. The best strategy may not be any of these simple shapes, but rather a more complex, smooth symmetric shape.
Arbitrary $n$-gons
As the above analysis likely already does not provide an optimal solution for the case $n = 4$, finding the correct answer for large $n$ is not going to be easy either. I'll just analyze one strategy below, which we can analyze quite easily for arbitrary $n$.
First, as also described in this post, the perimeter $p$ of a regular $n$-gon with "radius" $R$ (corresponding to the distance from the center to any of the corners) is given by
\begin{align}
p = 2 n R \sin \left( \frac{\pi}{n}\right).
\end{align}
As a special case, for instance, $n = 4$ with "radius" $\sqrt{2}$ as in the above analysis leads to perimeter $2 \cdot 4 \cdot \sqrt{2} \cdot \frac{1}{2} \sqrt{2} = 8$, as we saw above as well. Also, the shortest distance from the center to the edge (to the middle of any of the edges) is given by
\begin{align}
h = R \cos \left( \frac{\pi}{n}\right).
\end{align}
Note that $h = R - O(1/n^2)$ is slightly smaller than the radius; the middle of an edge is slightly closer to the center than a corner.
Now, as for a strategy, consider the simple case where again, the boy first tries to get as far from the teacher as possible (keeping the center of the polygon directly between him and the teacher), and then makes a run straight for the nearest edge or corner. First, as in the previous analysis, we will envision the "safe zone" in the center as a circle of a certain radius $r$, such that traversing the perimeter takes the boy the same amount of time as it takes the teacher to traverse the edge of the pool. This means $r$ is defined by the relation:
\begin{align}
2 \pi r = \frac{2 n R}{v} \sin\left(\frac{\pi}{n}\right).
\end{align}
This can be rewritten as $r = \frac{n R}{\pi v} \sin\left(\frac{\pi}{n}\right)$.
We will again consider two cases, based on whether the teacher decides to hang around in a corner or on the middle of an edge, and whether $n$ is odd or even. The two cases are whether directly opposite the teacher is another corner which the boy makes a run for, or whether opposite the teacher is the middle of an edge.
Case 1: Going for the center of an edge
As mentioned, the distance to the center of an edge is $R \cos \frac{\pi}{n}$, of which $r = \frac{n R}{\pi v} \sin\left(\frac{\pi}{n}\right)$ can be traversed for free. After that, a distance $R \cos \frac{\pi}{n} - r$ still needs to be swum, while the teacher traverses half the entire pool at a velocity $v$. So the breaking point of the boy getting away is:
\begin{align}
R \cos \left(\frac{\pi}{n}\right) - \frac{n R}{\pi v} \sin\left(\frac{\pi}{n}\right) = \frac{n R}{v} \sin\left(\frac{\pi}{n}\right).
\end{align}
This can be rewritten in terms of a condition on $v$ as:
\begin{align}
v = \frac{n (\pi + 1) \sin\left(\frac{\pi}{n}\right)}{\pi \cos \left(\frac{\pi}{n}\right)}.
\end{align}
For $n = 4$ we get the previous result $v(4) \geq 4 + \frac{4}{\pi}$, while for $n \to \infty$ we get the suboptimal result $v(n) \geq (\pi + 1) + O(1/n^2)$.
Case 2: Going for a corner
The analysis for this case is very similar, except that the distance traveled by the boy is now slightly longer - a factor $1 / \cos \frac{\pi}{n} > 1$ more. This ultimately leads to the very similar condition:
\begin{align}
v = \frac{n (\pi + 1) \sin\left(\frac{\pi}{n}\right)}{\pi}.
\end{align}
For $n = 4$ we get a bad result $v(4) \geq \frac{2 \sqrt{2}}{\pi} (1 + \pi) \approx 3.73$, which you would get if you don't adjust your strategy midway and head for the nearest edge (as you should), while for large $n \to \infty$ you do not really notice a difference with the previous case: $v(n) \geq (\pi + 1) + O(1/n^2)$.
Conjectured lower bound
Now, this is completely hand-wavy, but for the square we saw that the worst case (for our analysis and strategy) is when we head straight for the edge; if we first head towards a corner, we can adjust our direction mid-way through and escape even faster teachers than when we had directly towards the sides. If this "trend" continues for arbitrary $n$, then we might hope that the above bound for case (1) is actually a valid lower bound on $v(n)$ for larger $n$ as well:
\begin{align}
\Large\boxed{v(n) \stackrel{?}{\geq} \frac{n}{\pi} (\pi + 1) \tan\left(\frac{\pi}{n}\right)}
\end{align}
To get an idea of how this potential lower bound would scale in terms of $n$, here's a plot of $n$ against the above function $v(n)$:

But again, to prove these are indeed lower bounds on $v(n)$, you would have to consider arbitrary positions of the teacher, instead of just the corners or the centers of the edges.
Better strategies
Again, even if these are valid lower bounds, they are unlikely to be sharp bounds since, as mentioned before, optimal strategies should take into account the teacher's actions and should adjust the direction accordingly. This also explains why the limiting case $n \to \infty$ is off from the real optimum, as the optimal curve towards the edge should converge to a spiral/curve instead of a straight line.