Vyxal, 28 27 bytes
⇧Þ□λ÷N^›WDṘ²+^∑1<i;ÞZÞḋIRfi
Try it Online!
Based on @Arnauld's Javascript answer.
–1 per @emanresu A.
How?
λ÷N^›WDṘ²+^∑1<i; # find the (i, j)th entry of the matrix
λ ; # lambda STACK (top ->)
÷ # unwrap i j
N # negate i -j
^ # reverse stack -j i
› # increment -j i+1
W # wrap [i+1,-j]
# = [N,-T] (using Arnaud's notation)
D # triplicate [N,-T] [N,-T] [N,-T]
Ṙ # reverse [N,-T] [N,-T] [-T,N]
² # square [N,-T] [N,-T] [T^2,N^2]
+ # sum [N,-T] [T^2+N,N^2-T]
^ # reverse stack [T^2+N,N^2-T] [N,-T]
∑ # sum [T^2+N,N^2-T] N-T
1< # is < 1? [T^2+N,N^2-T] (1 if N-T<1 else 0)
# = [T^2+N,N^2-T] (1 if T>=N else 0)
i # index N^2-T if T>=N else T^2+N
⇧Þ□λ÷N^›WDṘ²+^∑1<i;ÞZ # make the matrix
⇧ # double increment, pushing N+2
Þ□ # (Nx2)x(Nx2) identity matrix
λ÷N^›WDṘ²+^∑1<i; # (above function)
ÞZ # fill by coordinates, i.e. replace each entry
# of the matrix with the result of calling the
# function on the entry's list of coordinates
ÞḋIRfi # output example (3x3 matrix)
Þḋ # antidiagonals [[5,3,9],[2,4],[1],[7],[6,8]]
I # into two pieces [ [[5,3,9],[2,4],[1]] , [[7],[6,8]] ]
R # vectorized reverse [ [[1],[2,4],[5,3,9]] , [[6,8],[7]] ]
f # flatten [1,2,4,5,3,9,6,8,7]
i # index by input