First, pictures are kept in the Photos Library, a package found in your Pictures folder. Pictures are not stored in the Photos app. It's a little hard to know exactly what you mean by "I replaced the iCloud photos in my Photos app on my Mac with a backup from Time Machine."
After your Time Machine Restore, do you now have two Libraries in your Pictures folder? You can see what Libraries you have by using the Library Picker: close Photos and Option Click on the Photos icon to bring up this window:

You can see that I have several Libraries. Clicking on any one will show the path to that Library. The one labeled "System Photo Library" is the one that can be connected to iCloud Photos, if you designate it so in Photos' Settings>General, like this:

If "Use as System Library" is grayed out, then that Library is already the System Library.
If this isn't what you're asking, I would suggest that you see this:
Basic Concepts and Terms About Photos - Apple Community
and this:
Understanding iCloud Photos - Apple Community
Let us know if you need more information. It would be useful to know these things:
- What macOS are you using?
- Where does your Mac's Photos Library reside-- in the Pictures folder of your internal drive, or on an external drive? or on a network? on iCloud drive?
- Do you have “Optimize Storage” checked in Photos’ Settings
- Do you see all your Mac’s Photos pictures at iCloud.com?
- Have you checked to see if the Apple Account is really really the same on the Mac and at iCloud.com?
- What is your storage at iCloud.com? At System Settings>[name]>iCloud>Storage , my Mac says 176 GB of 200 GB used. What does yours say?
- What is your storage on this Mac? At System Settings>General> Storage, my Mac says 745 GB of 1TBB used. What does yours say?
- What does your Library say at the bottom of the Library view? Like this:
