Ayling had to sit out the last three games of the season following his straight-red card for a lunge on Gabriel Martinelli in the 27th minute of this month's 2-1 defeat at Arsenal.
That meant a three-game ban and Leeds decided that Ayling's enforced absence provided a good opportunity for the defender to have surgery on a longstanding knee problem.
The injured defender still took his place with the Whites squad on crutches to support the team in Sunday's season finale at Brentford which Leeds approached sat in the bottom three.
A hard second season back in the Premier League in which promotion-winning boss Marcelo Bielsa was sacked would have ended with relegation had United not produced a better result than relegation rivals Burnley on the final day.
The two sides entered the final weekend of the campaign level on points but United's far inferior goal difference meant they had to out-point Burnley to survive.
But a difficult campaign had a happy ending as Leeds recorded a 2-1 victory at Brentford whilst Newcastle obliged by the same score at Burnley and Ayling has now issued a message of reflection on the season and a thank you to United's fans.
"The most mentally and physically demanding season so far," said Ayling, writing on his Instagram page.
"The football at times hasn't been great but one thing we will never let you down with is out attitude and commitment to this great club.
"We gave it everything every game and finally got what we needed to stay in this league.
"To the fans who stuck with us all year to the last minute of every game you were heard and your energy dragged us through some tough times.
"Now it's time to rest and get back to full fitness.
"The op went good and I'm hoping for a speedy recovery."
Ayling is expected to be out for between two and four months.