The 36-year-old confessed his pre-surgery fears after advancing to the third round of the Montreal Masters with a 6-2 6-1 defeat of Canadian Peter Polansky.
His 2016 injury came as he tweaked his knee while running a bath for one of his children just a few days after the Australian Open.
"Honestly, when I went into surgery, I was rather sad last year. I was rather worried about how I was going to come out of it," Federer said, "When I did come out of it, I was happy I woke up again, but I was sad that I had an operated knee.
"It was actually quite emotional for me. I was scared at the same time just to be in pain, of the unknown, I guess. I was not thinking of having a start to this kind of a season like back in 2006."
Federer surprised himself and the tennis world by winning the Australian Open last January over Rafael Nadal, then adding back-to-back Masters 1000 titles in Indian Wells and Miami.
He also won Wimbledon and Halle on grass.
The Swiss credits fitness for the quick turnaround.
"The key is that I'm actually healthy," he said.
"I knew that when I was healthy, I was going to be able to have chances to win slams again, to play against the best, and beat the best.
"That's also the reason why I'm still playing today. If I felt like I couldn't do all these things, it would not be enjoyable or I wouldn't be doing it any more.
"I would accept it, say, 'Look, I had a great career, but thanks very much, I'll do something else'."