As the OP notes in their answer, this quote does not appear in the Tennyson concordance, and does not seem to be from Tennyson. Indeed the dialogue does not claim this - McAllister guesses "Tennyson" as the author of Keating's reply, and Keating corrects him ("No, it's by me").
Two independent sources credit Keating's lines to an unnamed member of the cast, acting as Robin William's stand-in. In an interview with Nancy Griffin from 2014, the director of Dead Poets Society, Peter Weir, told an anecdote about the scene. During rehearsal he was trying to find a suitable quotation to use, and "was thumbing through a volume of Shakespeare". Williams started doing some trademark improvisation to amuse the cast and crew, and as the ensuing chaos died down:
a stand-in hands him [Weir] a couple of lines of poetry that he has
scrawled on a brown paper bag. Weir loves them.
As the cameras roll, Keating passes a bowl of potatoes to his
straitlaced colleague, McAllister (Leon Pownall), who criticizes him
for encouraging freethinking in his classroom. "Only in his dreams can
man be truly free," says Keating. "'Twas always thus and always thus
will be." McAllister asks if Tennyson is the author of those lines.
"No, Keating," is the reply. "Print!" cries Weir.
The story is corroborated in its essentials by an article in Cinephilia and Beyond.
On the first day of shooting, the director told the cast and crew that
if anyone had any thoughts or ideas, they shouldn’t hesitate to come
with them to either himself or the screenwriter... A fantastic example
of such artistic openness paying off can be found in the scene where
Williams’ Keating talks to a fellow teacher over lunch and recites a
line of poetry he himself had written. A week before shooting the
dialogue in question, Williams’ stand-in approached Schulman with his
own little poem that he thought was a perfect fit (“But only in their
dreams can men be truly free. ‘Twas always thus, and always thus will
be.”) And those were the lines that ended up in the film, instead of
what was originally in the script.
In this account the stand-in approaches Schulman (the screenwriter) rather than Weir directly, but the other details match up. Unfortunately I have not been able to identify Williams' stand-in (it is not uncommon for this information not to be recorded). It would be tempting to assume it would be Adam Bryant, who acted in the capacity in many of Williams' films, but without confirmation this just remains speculation. So we can be fairly sure that Keating's lines were original to the film. As the "Show me the heart unfettered.." line seems similarly hard to trace, it seems reasonable to assume that it also came from the same source.
;-))